HDC設備上下文是一種包含有關某個設備(如顯示器或打印機)的繪製屬性信息的 Windows 數據結構。全部繪製調用都經過設備上下文對象進行,這些對象封裝了用於繪製線條、形狀和文本的 Windows API。c++
外文名編程
HDC數據結構
屬 於ide
MFC中的設備上下文句柄this
封 裝指針
用於繪製線條等的 Windows APIhtm
CDC對象
MFC的DC的一個類three
CDC是MFC的DC的一個類ip
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.