Zhiyi Zhang : comctl32/button: Use the brush from WM_CTLCOLORSTATIC to fill text background for group boxes.

Alexandre Julliard julliard at winehq.org
Wed Feb 9 16:03:49 CST 2022


Module: wine
Branch: master
Commit: cb3b982148753f1d5b0485d1d075cab8965fa2cf
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cb3b982148753f1d5b0485d1d075cab8965fa2cf

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed Feb  9 16:45:23 2022 +0800

comctl32/button: Use the brush from WM_CTLCOLORSTATIC to fill text background for group boxes.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/button.c     | 13 ++++++++++++-
 dlls/comctl32/tests/misc.c |  3 +--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 1349e10c4c0..2ce12252460 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -2914,10 +2914,20 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
     HFONT font, hPrevFont = NULL;
     BOOL created_font = FALSE;
     TEXTMETRICW textMetric;
+    HBRUSH brush;
+    HWND parent;
+    HRESULT hr;
     LONG style;
     int part;
 
-    HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
+    /* DrawThemeParentBackground() is used for filling content background. The brush from
+     * WM_CTLCOLORSTATIC is used for filling text background */
+    parent = GetParent(infoPtr->hwnd);
+    if (!parent)
+        parent = infoPtr->hwnd;
+    brush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
+
+    hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
     if (SUCCEEDED(hr)) {
         font = CreateFontIndirectW(&lf);
         if (!font)
@@ -2969,6 +2979,7 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
             SelectClipRgn(hDC, textRegion);
             DeleteObject(textRegion);
         }
+        FillRect(hDC, &textRect, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
         BUTTON_DrawThemedLabel(infoPtr, hDC, dtFlags, &imageRect, &textRect, theme, part, state);
     }
 
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
index c3de9e68c5a..dc9648c1bf0 100644
--- a/dlls/comctl32/tests/misc.c
+++ b/dlls/comctl32/tests/misc.c
@@ -848,7 +848,7 @@ static void test_themed_background(void)
         {WC_BUTTONA, BS_RADIOBUTTON, radiobutton_seq},
         {WC_BUTTONA, BS_3STATE, checkbox_seq},
         {WC_BUTTONA, BS_AUTO3STATE, checkbox_seq},
-        {WC_BUTTONA, BS_GROUPBOX, groupbox_seq, TRUE},
+        {WC_BUTTONA, BS_GROUPBOX, groupbox_seq},
         {WC_BUTTONA, BS_USERBUTTON, pushbutton_seq},
         {WC_BUTTONA, BS_AUTORADIOBUTTON, radiobutton_seq},
         {WC_BUTTONA, BS_PUSHBOX, radiobutton_seq, TRUE},
@@ -962,7 +962,6 @@ static void test_themed_background(void)
 
                 /* WM_CTLCOLORSTATIC is used to fill text background */
                 color = GetPixel(hdc, 10, 10);
-                todo_wine
                 ok(color == 0x808080, "Expected color %#x, got %#x.\n", 0x808080, color);
             }
 




More information about the wine-cvs mailing list