Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1591418
  • 博文数量: 441
  • 博客积分: 20087
  • 博客等级: 上将
  • 技术积分: 3562
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-19 15:35
文章分类

全部博文(441)

文章存档

2014年(1)

2012年(1)

2011年(8)

2010年(16)

2009年(15)

2008年(152)

2007年(178)

2006年(70)

分类: C/C++

2006-11-22 14:59:15

在Windows编程中获取设备描述表的两种方法:

(1)用CWnd::GetDC和CWnd::ReleaseDC
    CDC *pDC = GetDC(); // Get DC
    // do some drawing
    ReleaseDC(pDC); // Release DC, needed

(2)CWnd::BeginPaint 和 CWnd::EndPaint
    PAINTSTRUCT ps;
    CDC *pDC = BeginPaint(&ps);  // Get DC
    // do some drawing
    EndPaint(&ps);  // Release DC

Special-Purpose Device Context Classes

Class Name Description
CPaintDC For drawing in a window's client area (OnPaint handlers only)
CClientDC For drawing in a window's client area (anywhere but OnPaint)
CWindowDC For drawing anywhere in a window, including the nonclient area
CMetaFileDC For drawing to a GDI metafile


具有特殊用途的MFC设备描述表类

类名 描述
CPaintDC 用于在窗口客户区绘图(仅限于OnPaint处理程序)
CClientDC 用于在窗口客户区绘图(除OnPaint外的任何处理程序)
CWindowDC 用于在窗口内任意地方绘图,包括非客户区
CMetaFileDC 用于向GDI元文件绘图


阅读(1299) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~