#include
class myframe:public CFrameWnd
{
public:
myframe()
{
Create(0,"Line Rectangle");
}
void OnPaint()
{
CPaintDC d(this);
CPen mypen(PS_SOLID,5,RGB(0,0,255));
CBrush mybrush(RGB(255,0,0));
d.SelectObject (&mypen);
d.SelectObject (&mybrush);
d.MoveTo (50 ,50);
d.LineTo (250,10);
d.Rectangle (50,100,250,200);
d.Ellipse (10,240,200,340);
d.Pie(250,50,100,150,110,150,100,20);
POINT pt[5]={250,150,250,300,300,400,300,320,190};
d.Polygon (pt,5);
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_PAINT()
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;
No comments:
Post a Comment