The difference between GetDC and GetWindowDC

本文介绍了GetDC和GetWindowDC两个API函数,用于获取指定窗口的设备上下文(DC),以便进行绘图操作。GetDC获取的是客户区的DC,而GetWindowDC则可以获取整个窗口的DC,包括标题栏、菜单和滚动条等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

GetDC
The GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.
This function retrieves a common, class, or private device context depending on the class style specified for the specified window. For common device contexts, GetDC assigns default attributes to the device context each time it is retrieved. For class and private device contexts, GetDC leaves the previously assigned attributes unchanged.
HDC GetDC(
    HWND hWnd                 // handle of window 
   );         
Parameters
hWnd
Identifies the window whose device context is to be retrieved.
 
GetWindowDC
The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.
HDC GetWindowDC(
    HWND hWnd                 // handle of window 
   );         
Parameters
hWnd
Identifies the window with a device context that is to be retrieved.
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值