Static control [02/10]: Background of enhanced metafiles

Michael Kaufmann hallo at michael-kaufmann.ch
Wed Jan 11 16:18:27 CST 2006


Changelog:
  - Always paint the background of static controls displaying enhanced 
metafiles
  - Also paint the background if there's no metafile to display
-------------- next part --------------
--- static-old.c	2006-01-11 22:27:48.000000000 +0100
+++ static.c	2006-01-11 22:29:52.000000000 +0100
@@ -708,17 +708,18 @@
 static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style )
 {
     HENHMETAFILE hEnhMetaFile;
-
-    /* message is still sent, even if the returned brush is not used */
-    SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
-                                   (WPARAM)hdc, (LPARAM)hwnd );
-
+    RECT rc;
+    HBRUSH hbrush;
+    
+    GetClientRect(hwnd, &rc);
+    hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
+    FillRect(hdc, &rc, hbrush);
     if ((hEnhMetaFile = (HENHMETAFILE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET )))
     {
-        RECT clientRect;
-        if(GetObjectType(hEnhMetaFile) != OBJ_ENHMETAFILE) return;
-        GetClientRect(hwnd, &clientRect);
-        PlayEnhMetaFile(hdc, hEnhMetaFile, &clientRect);
+        /* The control's current font is not selected into the
+           device context! */
+        if (GetObjectType(hEnhMetaFile) == OBJ_ENHMETAFILE)
+            PlayEnhMetaFile(hdc, hEnhMetaFile, &rc);
     }
 }
 


More information about the wine-patches mailing list