No :
MDI APPLICATION
DATE :
AIM
To create MDI and to draw an ellipse inside the view window using Device Context.
PROCEDURE
1.File -> New project tab->MFCAppWizard(exe). Give the location name and project
name
-> Ok.
2.Select Multiple Document option.
3.Accept the default in next 4 screen.
4.Click the finish button ->Ok button.
5. In the CPP file, write the following code in OnDraw()
void CMDINProjectView::OnDraw(CDC* pDC)
{
CMDINProjectDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(0,0,"Hello world");
pDC->SelectStockObject(GRAY_BRUSH);
pDC->Ellipse(CRect(0,20,100,120));
}
6.Build and execute the application.
7. Stop the program.
OUTPUT
RESULT:
Thus the program is executed and output is verified successfully.
EX.NO :
DATE :
AIM
To create a SDI Application with application wizard.
ALGORITHM
Step 1: Create a SDI application with project name SDIProj.
Step 2: Accept the default in the next four screens.
Step 3: Click finish button.
Step 4: Edit the OnDraw function in the view class.
void CSDINProjView::OnDraw(CDC* pDC)
{
pDC->TextOut(0,0,"Welcome to VC++ Lab");
pDC->SelectStockObject(GRAY_BRUSH);
pDC->Ellipse(CRect(0,0,100,120));
}
OUTPUT
RESULT
Thus the program is executed and output is verified successfully.
EX. NO:
KEYBOARD EVENT
DATE :
AIM
To write a VC++ program for keyboard events using Win32 Application.
ALGORITHM
Step 1: Start the program.
Step 2: Create an object for an class which inherits CWinApp.
Step 3: Object access InitInstance() function.
Step 4: Create a pointer object for the class which inherits CFrameWindow by
Allocating memory to object.
Step 5: Show the created window using SW_SHOWNORMAL.
Step 6: Stop the program.
PROGRAM
#include<afxwin.h>
class myapp:public CFrameWnd
{
public:
myapp()
{
Create(0,"HAI");
}
void OnKeyDown(UINT flag,CPoint p)
{
CPen pen;
CBrush bru;
CClientDC dc(this);
pen.CreatePen(PS_SOLID,5,RGB(50,50,130));
dc.SelectObject(pen);
dc.SelectObject(bru);
dc.Ellipse(p.x,p.y,p.x+50,p.y+50);
}
void OnKeyUp(UINT flag,CPoint p)
{
CPen pen;
CBrush bru;
CClientDC dc(this);
pen.CreatePen(PS_SOLID,5,RGB(200,120,130));
bru.CreateHatchBrush(HS_HORIZONTAL,RGB(150,150,130));
dc.SelectObject(pen);
dc.SelectObject(bru);
dc.Ellipse(50,50,150,150);
}
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(myapp,CFrameWnd)
ON_WM_KEYDOWN()
ON_WM_KEYUP()
END_MESSAGE_MAP()
class myfram:public CWinApp
{
public:
int InitInstance()
{
myapp *p;
p=new myapp;
p->ShowWindow(3);
m_pMainWnd=p;
return 1;
}
};
myfram a;
OUTPUT
RESULT
Thus the keyboard event program was compiled and successfully executed.
EX. NO:
MOUSE EVENTS
DATE :
AIM
To write a VC++ program for keyboard events using Win32 Application.
ALGORITHM
Step 1: Start the program.
Step 2: Create an object for an class which inherits CWinApp.
Step 3: Object access InitInstance() function.
Step 4: Create a pointer object for the class which inherits CFrameWindow by
Allocating memory to object.
Step 5: Show the created window using SW_SHOWNORMAL.
Step 6: Stop the program.
PROGRAM
#include<afxwin.h>
class myapp:public CFrameWnd
{
public:
myapp()
{
Create(0,"Mouse Events");
}
void OnLButtonDown(UINT flage,CPoint p)
{
CClientDC d(this);
d.TextOut(p.x,p.y,"WelCome",7);
}
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(myapp,CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
class myfram:public CWinApp
{
public:
int InitInstance()
{
myapp *p;
p=new myapp;
p->ShowWindow(3);
m_pMainWnd=p;
return 1;}};myfram a;
OUTPUT
RESULT
Thus the mouse events program was compiled and successfully executed.
EX. NO:
DATE :
AIM
To write a program to create window using MFC.
ALGORITHM
Step 1: Start the program.
Step 2: Create a window class that inherits CFrameWnd class.
Step 3: Define the constructor and create a window.
Step 4: Create the application class that inherits the CWinApp.
Step 5: Define the virtual function InitInstance().
Step 6: Create an object for the window class.
Step 7: Display the window.
Step 8: Globally declare an object for the application.
Step 9: Stop the program.
PROGRAM
#include<afxwin.h>
class mywin:public CFrameWnd
{
public:
mywin()
{
Create(0,"MY MFC");
}
};
class myapp:public CWinApp
{
public:
BOOL InitInstance()
{
mywin *p;
p=new mywin();
m_pMainWnd=p;
p->ShowWindow(SW_SHOWNORMAL);
return TRUE;
}
};
myapp a;
OUTPUT
RESULT
Thus the window creation program was compiled and successfully executed.
EX. NO:
DATE :
AIM
To write a program for message map using MFC.
ALGORITHM
Step 1: Start the program.
Step 2: Create a window class the inherits CFrameWnd class.
Step 3:Define the message handler for mouse move event.
Step 4: Declare the message map.
Step 5: Define the message map for mouse move event.
Step 6: Create the application class that inherits CWinApp.
Step 7: Define the virtual function InitInstance.
PROGRAM
#include<afxwin.h>
class mywin:public CFrameWnd
{
public: mywin()
{
Create(0,"MFC");
}
DECLARE_MESSAGE_MAP()
OUTPUT
RESULT
Thus the program was executed and the output is verified successfully.
EX. NO :
CALCULATOR
DATE :
AIM
To design a calculator in VB.
ALGORITHM
Step 1: Start the program.
Step 2: Design the calculator using the tools Frame, TextBox, Command button.
Step 3: To create a control array for the command button.
Step 4: To change the label and properties for each button.
Step 5: Type the required code for each button what action perform when the button
clicked.
Step 6: Save and execute the program.
Step 7: Stop the program.
PROGRAM
Dim s As Variant
Dim n1 As Variant, a As Variant
OUTPUT
RESULT
Thus the calculator program was executed and the output was verified.
EX.NO :
STRING MANIPULATION
DATE :
AIM
To write a program for string manipulation in VB.
ALGORITHM
Step 1: Start the program.
Step 2: Open the new Standard EXE.
Step 3: In the form to add the Label, TextBox, Command button for manipulate the
String.
Step 4: Type the require code for manipulating a string.
Step 5: Save and Run the program.
Step 6: Stop the program.
PROGRAM
Private Sub Command1_Click()
Text2.Text = LCase(Text1.Text)
Label2.Caption = "Lower Case"
End Sub
Text2.Text = Left(Text1.Text, 1)
Label2.Caption = "Ltrim"
End Sub
OUTPUT
RESULT
Thus the string manipulation program was executed and the output was verified.
EX.NO :
DATA CONTROL
DATE :
AIM
To write a program using the data control in VB.
ALGORITHM
Step 1: Start the program.
Step 2: Add the new form in the project.
Step 3: Design the form using Label, TextBox, Command button.
Step 4: To add the data control in the form.
Step 5: Create a new database for this program.
i)By select menu Add_Ins -> Visual Data Manager.
ii)Then click File -> New -> Microsoft Access -> Version 7.0 MDB.
iii)Then enter the database name in the selected location.
iv)Right click the properties, choose New Table.
v)Give the Table Name and add the necessary fields with corresponding
data types.
Step 6: In the data control properties we set the property DatabaseName and
RecordSource.
Step 7: Then change each TextBox property DataSource and DataField.
Step 8: Type the required code.
Step 9: Save and Run the program.
Step 10: Stop the program.
PROGRAM
Private Sub AddNew_Click()
Data1.Recordset.AddNew
AddNew.Enabled = False
Del.Enabled = False
Ext.Enabled = False
MovFirst.Enabled = False
MovLast.Enabled = False
MovPre.Enabled = False
MovNext.Enabled = False
End Sub
End Sub
OUTPUT
RESULT
Thus the data control program was executed and the output was verified.
EX.NO :
DATE :
AIM
To create a file system control by using VB6.0.
ALGORITHM
Step 1: Start a new project by selecting Standard EXE .
Step 2: Add a FileListBox, DriveListBox, DirListBox ,Command button, Label,
PictureBox and TextBox.
Step 3: Type the required code.
Step 4: Save and Run the program.
Step 5: Select the location which picture to show.
Step 6: Stop the program.
PROGRAM
Private Sub Command1_Click()
End
End Sub
End Sub
OUTPUT
RESULT
Thus the file system control program was executed and the output was verified.
EX.NO :
DATE :
AIM To write a program for ADO Data Control in VB6.0.
ALGORITHM
Step 1: Start the program.
Step 2: Add the new form in the project.
Step 3: Design the form using Label, TextBox, Command button.
Step 4: To add the data control in the form
i)Select the menu Project -> Components
ii)The dialog box will be appeared. In the dialog box check the option
iii)Microsoft ADO Data Control 6.0.
iv)Then the ADO Data Control 6.0 appear int the tool box and add into the
form.
Step 5: Create a new database for this program.
i)By select menu Add_Ins -> Visual Data Manager.
ii)Then click File -> New -> Microsoft Access -> Version 7.0 MDB.
iii)Then enter the database name in the selected location.
iv)Right click the properties, choose New Table.
v)Give the Table Name and add the necessary fields with corresponding
data types.
Step 6: In the ADODC property to set the ConnectionString as follow:
i)Click Build -> Microsoft Jet 3.51 OLE DB provider ->
Click Next.
ii)In the Connection Tab select the database name.
iii)Then click Test Connection Button -> Ok -> Ok ->Ok.
Step 7: In the ADODC property to set the RecordSource.
In theCommand Text(SQL) type any SQL Command to select the rows -> Ok.
Step 8: Then change each TextBox property DataSource as and DataField.
Step 9: Type the required code.
Step 10: Save and Run the program.
Step 11: Stop the program.
PROGRAM
Private Sub Command1_Click()
Text7.Text = Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text)
Text8.Text = Val(Text7.Text) / 4
If (Val(Text3.Text) < 35 Or Val(Text4.Text) < 35 Or Val(Text5.Text) < 35 Or Val(Text6.Text) <
35) Then
Text9.Text = "FAIL"
OUTPUT
RESULT
Thus the ADO data control program was executed and the output was verified.
EX.NO :
DATE :
AIM
To write a simple VB application that demonstrate the use of keyboard and mouse events.
ALGORITHM
Step 1: Start a new project by select Standard EXE form new project.
Step 2: Then type the required code.
Step 3: Save and Run the program.
Step 4: Stop the program.
PROGRAM
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case Shift
Case vbShiftMask
Print "You pressed the shift key"
Case vbCtrlMask
Print "You pressed the ctrl key"
Case vbShiftMask
Print "You pressed the shift key+ alt key"
Case vbAltMask
Print "You pressed the alt key"
End Select
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Circle (X, Y), 75
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawWidth = 3
PSet (X, Y)
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ccode As Integer
Randomize
ccode = Int(15 * Rnd)
FillStyle = 0
FillColor = QBColor(ccode)
Circle (X, Y), 75
End Sub
OUTPUT
RESULT
Thus the program for keyboard and mouse events was executed successfully and the
output was verified.
EX.NO :
PALINDROME
DATE :
AIM
To develop a simple application to reverse a given string and to check whether the string
is palindrome or not.
ALGORITHM
Step 1: Start a new project by select Standard EXE form new project.
PROGRAM
Option Explicit
Dim str1, str2 As String
OUTPUT
RESULT
Thus the palindrome program was executed successfully and the output was verified.
DATA REPORT
EX.NO :
DATE :
AIM
Step 1: Start new project.
Step 2: Design the form using Command button.
Step 3: Add the Data Environment and Data Report to the project.
Click menu Project -> Add Data Environment.
Click menu Project -> Add Data Report.
Step 5: Create a new database for this program.
i)By select menu Add_Ins -> Visual Data Manager.
ii)Then click File -> New -> Microsoft Access -> Version 7.0 MDB.
iii)Then enter the database name in the selected location.
iv)Right click the properties, choose New Table.
v)Give the Table Name and add the necessary fields with corresponding
data types.
Step 6: To create a ODBC Connection Start -> Control Pannal ->
System and Security -> Administrative Tools -> Data Source(ODBC).
i)In the User DSN Tab Click Add button -> Select the Driver do Microsoft
Access(*.mdb).
ii)Then the ODBC Microsoft Access setup diabox appear. Give the DataSourceName.
Select the database-> Ok -> Ok -> Ok.
Step 7: In the Data Environment right click the connection choose properties.
Select the Microsoft OLE DB Provider for ODBC Drivers -> Next .
Give the select the data source name. Click Test Connection button ->Ok ->Ok.
Step 8: Right click the connection Add Command.
Step 9: Right click the command1 choose properties.
Step 10: Give Database Object as Table and select the object name ->Ok.
Step 11: Drag the command1 in the Data Environment into Data Report.
Step 12: Set the Data Report property DataSource as Data Environment and DataMember as
Command1.
Step 13: Type the required code in Command1_Click()
OUTPUT
RESULT
Thus the Data Report program was executed and the output was verified.
EX.NO :
SLIDER CONTROL
DATE :
AIM
To write a VC++ Program for creating a slider control using Win32 application.
ALGORITHM
Step 1: Start the program.
Step 2: Open a new project by selecting File>New>Win32 Application.
Select the location and give the File Name then click Ok ->Finish ->Ok.
Step 3: Open a new source file by selecting File>New>C++ Source files and Click
Ok.
Step 4: Type the required code.
Step 5: Select menu Project>Settings>Microsoft foundation classes choose for Use
MFC in a Shared DLL.
Step 7: Compile and Execute the program.
Step 8: Stop the program.
PROGRAM
#include<afxwin.h>
#include<afxcmn.h>
class myframe:public CFrameWnd
{
private:
CSliderCtrl sli;
CButton gr;
public:
myframe()
{
CString mywindowclass;
mywindowclass=AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW,0,
(HBRUSH)::GetStockObject(LTGRAY_BRUSH),0);
Create(mywindowclass,"Slider Control");
}
int OnCreate(LPCREATESTRUCT I)
{
CFrameWnd::OnCreate(I);
gr.Create("SLIDER DISPLAY",WS_CHILD|WS_VISIBLE|
BS_GROUPBOX,CRect(30,30,310,100),this,1);
sli.Create(WS_CHILD|WS_VISIBLE|TBS_HORZ|TBS_AUTOTICKS|
TBS_BOTTOM|TBS_ENABLESELRANGE,CRect(35,50,305,90),this,2);
sli.SetRange(0,8);
sli.SetPos(2);
sli.SetSelection(0,2);
sli.SetPageSize(3);
return 0;
}
void OnHScroll(UINT code,UINT pos,CScrollBar *scroll)
{
switch(code)
{
case TB_LINEUP:
case TB_LINEDOWN:
case TB_PAGEUP:
case TB_PAGEDOWN:
case TB_TOP:
case TB_BOTTOM:
pos=sli.GetPos();
sli.SetSelection(0,pos);
sli.SetTic(pos);
break;
case TB_THUMBPOSITION:
sli.SetSelection(0,pos);
sli.SetTic(pos);
break;
case TB_THUMBTRACK:
sli.SetSelection(0,pos);
sli.SetTic(pos);
break;
}
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_CREATE()
ON_WM_HSCROLL()
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
int InitInstance()
{
myframe *p;
p=new myframe;
p->ShowWindow(3);
m_pMainWnd=p;
return 1;
}
};
myapp a;
OUTPUT
RESULT
Thus the Slider Control program was executed and the output was verified.
EX.NO :
DATE :
AIM
To write a Visual C++ program for creating a TreeView Control using Win32
Application.
ALGORITHM
Step 1: Start the program.
Step 2: Open a new project by selecting File>New>Win32 Application.
Select the location and give the File Name then click Ok ->Finish ->Ok.
Step 3: Open a new source file by selecting File>New>C++ Source files and Click
Ok.
Step 4: Type the required code.
Step 5: Select menu Project>Settings>Microsoft foundation classes choose for Use
MFC in a Shared DLL.
Step 7: Compile and Execute the program.
Step 8: Stop the program.
PROGRAM
#include<afxwin.h>
#include<afxcmn.h>
class myframe:public CFrameWnd
{
private:
CTreeCtrl tree;
public:
myframe()
{
Create(0,"Tree View Control");
}
int OnCreate(LPCREATESTRUCT I)
{
HTREEITEM lang,opersys,c,cpp,java;
CFrameWnd::OnCreate(I);
tree.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|
TVS_LINESATROOT|TVS_HASBUTTONS|
TVS_SHOWSELALWAYS,CRect(30,30,300,350),this,1);
lang=tree.InsertItem("Computer languages",TVI_ROOT,TVI_SORT);
c=tree.InsertItem("C",lang,TVI_SORT);
tree.InsertItem("TC",c);
tree.InsertItem("QC",c);
tree.InsertItem("MSC",c);
cpp=tree.InsertItem("C++",lang,TVI_SORT);
tree.InsertItem("VC++",cpp);
tree.InsertItem("Botland C++",cpp);
java=tree.InsertItem("java",lang,TVI_SORT);
tree.InsertItem("VJ++",java);
tree.InsertItem("Symentec cafe",java);
tree.InsertItem("Sun JDK",java);
opersys=tree.InsertItem("Operating Systems",TVI_ROOT,TVI_SORT);
tree.InsertItem("Win 3.1",opersys);
tree.InsertItem("Win 95",opersys);
tree.InsertItem("Win NT",opersys);
return 0;
}
int OnNotify(WPARAM w,LPARAM l,LRESULT *r)
{
HTREEITEM h;
CString str;
CWnd::OnNotify(w,l,r);
NM_TREEVIEW *p=(NM_TREEVIEW *)l;
if(p->hdr.code==TVN_SELCHANGED)
{
h=tree.GetSelectedItem();
str=tree.GetItemText(h);
MessageBox(str,"You have selected");
}
return 1;
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
int InitInstance()
{
myframe *p;
p=new myframe;
p->ShowWindow(3);
m_pMainWnd=p;
return 1;
}
};
myapp a;
OUTPUT
RESULT
Thus the TreeView Control program was executed and the output was verified.
EX.NO :
SHAPE
DATE :
AIM
To write a program for draw different shape using Common Dialog Control in VB.
ALGORITHM
Step 1: Create a new project.
Step 2: To design the form by adding ListBox, Command button, Shape and add the
Common Dialog Control into form by Select Project menu-> Components->
Check Microsoft Common Control6.0.
Step 3: Type the required code.
Step 4: Save and Run the program.
Step 5: Stop the program.
PROGRAM
Private Sub Command1_Click()
End
End Sub
Shape1.FillColor = cd.Color
Shape1.Shape = 1
Case 2
cd.ShowColor
Shape1.FillColor = cd.Color
Shape1.Shape = 2
Case 3
cd.ShowColor
Shape1.FillColor = cd.Color
Shape1.Shape = 3
Case 4
cd.ShowColor
Shape1.FillColor = cd.Color
Shape1.Shape = 4
Case 5
cd.ShowColor
Shape1.FillColor = cd.Color
Shape1.Shape = 5
End Select
End Sub
OUTPUT
RESULT
Thus the shape program was executed and the output was verified.
EX.NO :
ESCAPE KEY
DATE :
AIM
To write a program for to press the escape key to close the form in VB.
ALGORITHM
Step 1: Start the program.
Step 2: Create a new project.
PROGRAM
Private Sub Command1_Click()
Text1.Text = ""
End Sub
escape
Private Sub Command2_Click()
MsgBox "Press Esc Key"
End Sub
OUTPUT
RESULT
Thus the program was executed and the output was verified.
EX.NO :
DATABASE CONNECTIVITY
DATE :
AIM
To create a SDI application with Database Connection.
PROCEDURE
1.
data
i)
Fields
Types
Studname
Text
Grade
Text
ii)
iii)
iv)
Select the database.
Database Name: Student
Table Name: Information
ptr=new CStudent();
}
CProject15View::CProject15View()
{
ptr->Close();
delete ptr;
}
void CProject15View::OnInitialUpdate()
{
if(ptr->IsOpen())
ptr->Close();
ptr->Open();
}
void CProject15View::OnDraw(CDC *pDC)
{
int x=100;
int y=100;
if(ptr->ISBOF())
{
pDC->TextOut(100,100,Empty record set);
return;
}
ptr->MoveFirst();
while(!ptr->IsEOF())
{
pDC->TextOut(x,y,ptr->m_Studentname);
pDC->TextOut(x+100,y,ptr->m_Regno);
pDC->TextOut(x+150,y,ptr->m_Grade);
y=y+50;
ptr->MoveNext();
}
}
10. Add the student header file in CProject15View.cpp file
#include student.h
RESULT
Thus the program was executed and the output was verified.
EX. NO :
DATE :
AIM
To create a dll and link that to the application implicity.
ALGORITHM
Building dll file
Step 1: Create a DLL application by selecting MFCAPPWizard(dll).
Step 2: Give the project name Projdll.
Step 3: In the application wizard screen, Choose-> MFC Shared dll.
Step 4: Click finish button.
Step 5: Include the header file in the projdll headerfile.
#include math.h
Control
Caption
ID
Static
IDC_STATIC
Edit
IDC_NUM
Static
IDC_STATIC1
Edit
IDC_RESULT
Button
SQRT
IDC_SQRT
Variable
IDC_NUM
m_num
IDC_RESULT
m_Result
void CDllexeView::OnSqrt()
{
OUTPUT
RESULT
Thus the program was executed and the output was verified.
EX.NO :
DATE :
INTERFACE OBJECTS
AIM
To create a SDI application illustrate the concept of GDI objects.
ALGORITHM
Step 1:Create the SDI application GDIproj.
Step 2:Create the menu GDI in the menu bar using resource editor, and add
the following menu items into GDI.
Menu Item
ID
Pen
ID_GDI_PEN
Brush
ID_GDI_BRUSH
Font
ID_GDI_FONT
Step 3: Add the following member variable in the view class int MenuItem .
Step 4: Add message handlers for menu items Pen, Brush, Font
.
Step 5: Edit the message handlers
void CGDIView::OnGdiPen()
{
MenuItem=1;
Invalidate(true);
}
void CGDIView::OnGdiBrush()
{
MenuItem=2;
Invalidate(true);}
void CGDIView::OnGdiFont()
{
MenuItem=3;
Invalidate(true);
}
Step 6: Edit the code for OnDraw function
void CGDIView::OnDraw(CDC* pDC)
{
CGDIDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
if(MenuItem==1)
{
CPen pen;
pen.CreatePen(PS_DOT,1,RGB(100,100,200));
pDC->SelectObject(pen);
pDC->MoveTo(100,100);
pDC->LineTo(300,300);
pen.DeleteObject();
pen.CreatePen(PS_SOLID,5,RGB(250,100,200));
pDC->SelectObject(pen);
pDC->Ellipse(250,250,500,300);
}
else if(MenuItem==2)
{
CBrush brush;
brush.CreateSolidBrush(RGB(25,10,10));
pDC->SelectObject(brush);
pDC->RoundRect(100,100,200,300,10,10);
CBrush brush1;
brush1.CreateHatchBrush(HS_BDIAGONAL,RGB(0,0,255));
pDC->SelectObject(brush1);
pDC->Ellipse(300,100,400,300);
}
else if(MenuItem==3)
{
CFont font;
font.CreateFont(50,25,0,0,900,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFA
ULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,"Monotype Corsiva");
pDC->SelectObject(font);
pDC->SetTextColor(RGB(0,10,15));
pDC->TextOut(10,300,"Visual Programming Lab");
}
}
Step 7: Compile and execute the program.
OUTPUT
RESULT
Thus the GDI program was executed and the output was verified.