WM_NCPAINT and GetDCEx

In one of the Win32 tips, you mentioned that there is a undocumented flag you have to pass to GetDCEx during the WM_NCPAINT message in order to obtain the correct DC. The trick works on Windows XP, but it doesn't work in Windows 7 anymore. The workaround is to call GetWindowDC instead of GetDCEx. Also calling GetDCEx(hwnd, hrgn, DCX_WINDOW | DCX_INTERSECTRGN | 0x10000) doesn't always give you the clipped DC (the documentation says it would clip to the "frame" area only). A simple test to prove that is to do a FillRect with GetStockObject(WHITE_BRUSH) on that DC. Sometimes GetDCEx would return a DC that's clipped to frame area, sometimes it would return a normal DC (Clip to the entire control area).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值