netrookie
全部博文(158)
2010年(71)
2009年(87)
bluefire
Bsolar
yang5059
Judy_070
mengyun8
wg198812
prolee
taiyangs
StarWing
分类: C/C++
2010-02-06 12:28:39
CPoint MoveTo( int x, int y ); CPoint MoveTo( POINT point );
BOOL LineTo( int x, int y ); BOOL LineTo( POINT point );
class CMyApp : public CWinApp { virtual BOOL InitInstance(); }; class CMainWindow : public CFrameWnd { public: CMainWindow(); protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP() };
#include <afxwin.h> #include "lineDemo.h" CMyApp myApp; BOOL CMyApp::InitInstance() { m_pMainWnd = new CMainWindow; m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWindow, CFrameWnd) ON_WM_PAINT() END_MESSAGE_MAP() CMainWindow::CMainWindow() { Create(NULL, _T("画线了")); } void CMainWindow::OnPaint() { CPaintDC dc(this); RECT rect; GetClientRect(&rect); CPoint p(rect.right, rect.bottom); dc.LineTo(p); p.x = rect.right; p.y = 0; dc.MoveTo(p); dc.LineTo(0, rect.bottom); dc.Ellipse(&rect); }
上一篇:我的第一个MFC程序
下一篇:SIZE,POINT,CPoint, CSize浅谈
登录 注册