绘图基础--画笔
2013-09-18 11:33
85 查看
绘图基础--画笔
// line2.cpp #include <afxwin.h> // Define the application class class CApp : public CWinApp { public: virtual BOOL InitInstance(); }; CApp App; // define the window class class CWindow : public CFrameWnd { public: CWindow(); void OnPaint(); DECLARE_MESSAGE_MAP() }; // The window's constructor CWindow::CWindow() { Create(NULL, "Drawing Tests", WS_OVERLAPPEDWINDOW, CRect(0,0,500,300)); } // The message map BEGIN_MESSAGE_MAP( CWindow, CFrameWnd ) ON_WM_PAINT() END_MESSAGE_MAP() // Handle exposure events void CWindow::OnPaint() { CRect rect; int x; GetClientRect( rect ); CPaintDC dc(this); // 创建画笔(实线,2像素,蓝色) CPen pen(PS_SOLID, 2, RGB(0,0,255)), *oldPen; oldPen = dc.SelectObject(&pen); // 画线 for (x=0; x<rect.Width(); x+=10) { dc.MoveTo(0,0); dc.LineTo(x,rect.Height()); } // Return old pen; dc.SelectObject(oldPen); } // Init the application BOOL CApp::InitInstance() { m_pMainWnd = new CWindow(); m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; }
相关文章推荐
- 绘图基础--使用画笔和画刷绘制网络
- 第五章 绘图基础 (GDI、设备环境、点线绘制、填充)
- 机器学习实战第二章-k近邻算法(包含一些python绘图基础)
- HTML5绘图基础_09_绘制弧线详解
- 更新 第五章 绘图基础(设备环境)
- opencv3学习之绘图基础
- MATLAB基础7-MATLAB绘图功能
- iOS程序猿之iOS绘图基础(draw)
- Android绘图机制与处理技巧(四)——Android图像处理之画笔特效处理
- 自定义view—绘图基础Canvas+Paint
- Android学习教程之2D绘图基础及绘制太极图
- Android中Canvas绘图基础详解(附源码下载)
- android基础--canvas绘图
- canvas-炫丽的倒计时效果Canvas绘图与动画基础
- java基础 绘图技术.坦克大战 之java绘图坐标体系(二)
- 【转载】OmniGraffle (二)基础绘图和模具
- MfC基础--绘图基础--win32
- Android绘图基础
- Android绘图机制与处理技巧(五)Android图像处理之画笔特效处理
- [Matlab]基础教程学习笔记(五):二维底层绘图修饰