Saturday, December 5, 2009

LINE & RECTANGLE

Draw a line and rectangle program in Visual C++ .The sample program source code is following:

class line:public CFrameWnd
{
public:
line()
{
Create(0,"Display Line & Rectangle");
}
void OnPaint()
{
CPaintDC cd(this);
cd.MoveTo(10,50);
cd.LineTo(225,10);
cd.Rectangle(50,100,150,500);
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(line,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
class rect:public CWinApp
{
public:
int InitInstance()
{
line *lr;
lr=new line;
m_pMainWnd=lr;
lr->ShowWindow(3);
return 1;
}
};
rect r;

0 comments:

Post a Comment

  © Blogger template Coozie by Ourblogtemplates.com 2008

Back to TOP