Ownerdraw buttons should erase themselves in WM_ERASEBKGND.

This commit is contained in:
Huw Davies 2003-11-11 00:26:29 +00:00 committed by Alexandre Julliard
parent 818c5861c4
commit f11b022fbb
1 changed files with 11 additions and 0 deletions

View File

@ -205,6 +205,17 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
return 0; return 0;
case WM_ERASEBKGND: case WM_ERASEBKGND:
if (btn_type == BS_OWNERDRAW)
{
HDC hdc = (HDC)wParam;
RECT rc;
HBRUSH hBrush = (HBRUSH)SendMessageW(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = (HBRUSH)DefWindowProcW(GetParent(hWnd), WM_CTLCOLORBTN,
(WPARAM)hdc, (LPARAM)hWnd);
GetClientRect(hWnd, &rc);
FillRect(hdc, &rc, hBrush);
}
return 1; return 1;
case WM_PAINT: case WM_PAINT: