基本概念學習---設備上下文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.









發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章