button: ownerdraw erase

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 10 09:01:46 CST 2003


        Huw Davies <huw at codeweavers.com>
        Ownerdraw buttons should erase themselves in WM_ERASEBKGND.
-- 
Huw Davies
huw at codeweavers.com
Index: controls/button.c
===================================================================
RCS file: /home/wine/wine/controls/button.c,v
retrieving revision 1.67
diff -u -r1.67 button.c
--- controls/button.c	10 Sep 2003 03:56:49 -0000	1.67
+++ controls/button.c	10 Nov 2003 14:58:54 -0000
@@ -205,6 +205,17 @@
         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:



More information about the wine-patches mailing list