CDC类中的m_hDC和m_hArrtriDC有啥区别呢?

clever101
博客专家认证
2011-06-27 12:02:01
CDC类中有两个public数据成员:
HDC m_hDC和 HDC m_hArrtriDC。

请问它们有啥区别呢?
...全文
66 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
clever101 2011-06-27
  • 打赏
  • 举报
回复
CDC contains two device contexts, m_hDC and m_hAttribDC, which, on creation of a CDC object, refer to the same device. CDC directs all output GDI calls to m_hDC and most attribute GDI calls to m_hAttribDC. (An example of an attribute call is GetTextColor, while SetTextColor is an output call.)

For example, the framework uses these two device contexts to implement a CMetaFileDC object that will send output to a metafile while reading attributes from a physical device. Print preview is implemented in the framework in a similar fashion. You can also use the two device contexts in a similar way in your application-specific code.

There are times when you may need text-metric information from both the m_hDC and m_hAttribDC device contexts. The following pairs of functions provide this capability:
Uses m_hAttribDC Uses m_hDC

GetTextExtent


GetOutputTextExtent

GetTabbedTextExtent


GetOutputTabbedTextExtent

GetTextMetrics


GetOutputTextMetrics

GetCharWidth


GetOutputCharWidth

For more information on CDC, see Device Contexts.

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧