WM_NCPAINT and GetDCEx

来源:互联网 发布:247143nx 4010淘宝价格 编辑:程序博客网 时间:2024/05/17 08:46

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).

原创粉丝点击