您的位置:首页 > 其它

Common and private DC

2006-11-26 01:54 197 查看
Common and private DC

The two primary types of display device contexts are common and private.
(The third supported type, class, is obsolete.) When retrieving the DC handle,
the DC will be private if the window class was registered with the CS_OWNDC class style,
otherwise it will be common.

A common DC handle is retrieved when GetDC (or BeginPaint) is called. Every time it’s retrieved,
it references a new DC initialized with a default set of attributes.
Thus to keep memory usage low, the common DC should be released with ReleaseDC (or EndPaint).
The common DC is generally used as a temporary DC,
acquired and released by each message handler needing a DC.
A private DC is created when a window is created. Its handle can be retrieved with the GetDC (or BeginPaint) function,
and it’s not necessary to call ReleaseDC. Unlike the common DC,
it is not reinitialized on retrieval.
As a result, you avoid the need to reset all your drawing tools and modes with every message requiring graphics. 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  class types function tools each
相关文章推荐