1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include<afxwin.h>
#include<windows.h>
class myframe : public CFrameWnd
{
public:
myframe()
{
CRect winrc(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
Create(0,"Hello",WS_OVERLAPPED|WS_SYSMENU,winrc);
}
void OnPaint()
{
CFrameWnd::OnPaint();
CWindowDC d(this);
CPen mypen(PS_SOLID,2,RGB(255,0,0));
CBrush mybrush(RGB(0,255,0));
d.SelectObject(mypen);
d.SelectObject(mybrush);
d.SetTextColor(RGB(0,0,255));
d.TextOut(1,1,"Painting in non Client Area",strlen("Painting in non Client Area"));
d.Rectangle(0,0,200,500);
}
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(1);
m_pMainWnd=p;
return 1;
}
};
myapp a;
|