当前位置首页 > 百科> 正文

HDC(MFC中的设备上下文句柄)

2019-10-18 01:56:44 百科
HDC(MFC中的设备上下文句柄)

HDC(MFC中的设备上下文句柄)

HDC设备上下文是一种包含有关某个设备(如显示器或印表机)的绘製属性信息的 Windows 数据结构。所有绘製调用都通过设备上下文对象进行,这些对象封装了用于绘製线条、形状和文本的 Windows API。

基本介绍

  • 外文名:HDC
  • 属于:MFC中的设备上下文句柄
  • 封装:用于绘製线条等的 Windows API
  • CDC:MFC的DC的一个类

简介

CDC是MFC的DC的一个类
hDC是DC的句柄,API中的一个类似指针的数据类型.
MFC类的前缀都是C开头的
H开头的大多数是句柄
这是为了助记,是编程读\写代码的好的习惯.
CDC中所有MFC的DC的基类.常用的CClientDC dc(this);就是CDC的子类(或称派生类).
CDC等设备上下文类,都含有一个类的成员变数:m_hDc,用来保存与该类相关的句柄.其道理与CWnd类提供m_Wnd成员变数保存与视窗相关的句柄是一样的。
记住下面的一句话,会有助于你的理解.
DC(设备描述表)在c++中的解释

设备描述

设备上下文允许在 Windows 中进行与设备无关的绘製。设备上下文可用于绘製到萤幕、印表机或者图元档案。
Device Contexts
A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output. The graphic objects include a pen for line drawing, a brush for painting and filling, a bitmap for copying or scrolling parts of the screen, a palette for defining the set of available colors, a region for clipping and other operations, and a path for painting and drawing operations. The remainder of this section is divided into the following three areas.
声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:baisebaisebaise@yeah.net