From f11b022fbb508bc2a1950d74b1e7d2ac671eb28e Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 11 Nov 2003 00:26:29 +0000 Subject: [PATCH] Ownerdraw buttons should erase themselves in WM_ERASEBKGND. --- controls/button.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/controls/button.c b/controls/button.c index 2ffa0b9a4ba..ec63309436c 100644 --- a/controls/button.c +++ b/controls/button.c @@ -205,6 +205,17 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, return 0; 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; case WM_PAINT: