Gerard Patel gerard.patel@nerim.net writes:
By changing rgrc[0] when responding to WM_NCCALCSIZE. It seems that it is only possible to erase properly the 'custom' nonclient area by using GetWindowDC... So :
--- defwnd.c.orig Sat Aug 11 10:23:18 2001 +++ defwnd.c Fri Aug 17 19:47:17 2001 @@ -462,8 +462,12 @@ if (!hbr) return 0;
/* GetClientRect used to be GetClipBox, but it is not what
* Windows does, and it breaks badly with CS_PARENTDC */
GetClientRect( wndPtr->hwndSelf, &rect );
* Windows does, and it breaks badly with CS_PARENTDC
* GetClientRect breaks too when we are called with a window
* DC (!!) - what next ? */
rect.left = rect.top = 0;
rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; DPtoLP( hdc, (LPPOINT)&rect, 2 ); FillRect( hdc, &rect, hbr ); return 1;
What do you think ?
That's not what Windows does. If you pass a window DC to WM_ERASEBKGND it only erases an area equivalent to the client area (shifted to be relative to the whole window), so GetClientRect is correct IMO. The non-client area should be painted upon WM_NCPAINT, not WM_ERASEBKGND.