VC++深入详解-第四章学习心得
来源:互联网 发布:linux深度商店下载 编辑:程序博客网 时间:2024/05/16 11:12
这一章节主要讲解了 简单的绘图
主要是通过一些小的例子让我们学会了VC++的一些基本操作
void CDrawView::OnLButtonDown(UINT nFlags, CPoint point) {// TODO: Add your message handler code here and/or call defaultm_ptOrigin = point;//MessageBox("hello");CView::OnLButtonDown(nFlags, point);}void CDrawView::OnLButtonUp(UINT nFlags, CPoint point) {// TODO: Add your message handler code here and/or call default/*//获得窗口的设备描述表HDC hdc;hdc = ::GetDC(m_hWnd);//移动到线条起点MoveToEx(hdc,m_ptOrigin.x,m_ptOrigin.y,NULL);//画线LineTo(hdc,point.x,point.y);//释放::ReleaseDC(m_hWnd,hdc);CView::OnLButtonUp(nFlags, point);*//*//获得窗口的设备描述表对象的指针 CDC* pDC = GetDC();pDC->MoveTo(m_ptOrigin);pDC->LineTo(point);ReleaseDC(pDC);CView::OnLButtonUp(nFlags, point);*//*CClientDC dc(this);dc.MoveTo(m_ptOrigin);dc.LineTo(point);CView::OnLButtonUp(nFlags, point);*//*//CWindowDC wDC(this);//CWindowDC wDC(GetParent());CWindowDC wDC(GetDesktopWindow());wDC.MoveTo(m_ptOrigin);wDC.LineTo(point);CView::OnLButtonUp(nFlags, point);*//* CPen pen(PS_SOLID,1,RGB(255,0,0));CClientDC dc(this);CPen* pOldPen = dc.SelectObject(&pen);dc.MoveTo(m_ptOrigin);dc.LineTo(point);dc.SelectObject(pOldPen);CView::OnLButtonUp(nFlags, point);*//*//定义画刷CBrush brush(RGB(255,0,0));//获得窗口的设备描述表对象CClientDC dc(this);//画矩形dc.FillRect(CRect(m_ptOrigin,point),&brush);CView::OnLButtonUp(nFlags, point);*///创建位图CBitmap bitmap;//加载位图资源bitmap.LoadBitmap(IDB_BITMAP1);//画刷CBrush brush(&bitmap);CClientDC dc(this);dc.FillRect(CRect(m_ptOrigin,point),&brush);CView::OnLButtonUp(nFlags, point);}
后面还有几个小例子就没有一一去写了,基本类似,因为个人觉得实用性不大,需要看相关绘图方面的资料时再回头来看
- VC++深入详解-第四章学习心得
- VC++深入详解-第二章学习心得
- VC++深入详解-第三章学习心得
- VC++深入详解-第五章学习心得
- VC++深入详解-第六章学习心得
- 《VC++深入详解》第四章 简单绘图
- VC++深入详解-第一章学习心得(一)
- VC++深入详解-第一章学习心得(二)
- 孙鑫《vc ++深入详解》第四章简单绘图
- VC++深入详解第四章——简单绘图
- 《VC++深入详解》学习笔记 第四章 简单绘图
- [连载]vc++深入详解(孙鑫)视频笔记-第四课
- VC++深入详解第二章
- VC++深入详解第三章
- vc++深入详解第六章
- 《VC++深入详解》第三章
- C++ Primer学习心得第四章
- VC++深入详解 第6章 菜单
- 从 QA 到 EP -- 转自豌豆荚
- Oracle 中实例详解ROW_NUMBER()用法
- 基于IAP和Keil MDK的远程升级设计
- 电流互感器参数
- 安防监控相关
- VC++深入详解-第四章学习心得
- js提取url的参数
- iOS开发中一些有用的小代码
- C++派生类访问权限
- Android Notification通知详解
- SELinux - Multi-Level Security (MLS)
- jquery .live(动态绑定事件)
- git和github使用
- 地理编码