Commit cb3b9821 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

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

parent c69d3bb7
...@@ -2914,10 +2914,20 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in ...@@ -2914,10 +2914,20 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
HFONT font, hPrevFont = NULL; HFONT font, hPrevFont = NULL;
BOOL created_font = FALSE; BOOL created_font = FALSE;
TEXTMETRICW textMetric; TEXTMETRICW textMetric;
HBRUSH brush;
HWND parent;
HRESULT hr;
LONG style; LONG style;
int part; 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)) { if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf); font = CreateFontIndirectW(&lf);
if (!font) if (!font)
...@@ -2969,6 +2979,7 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in ...@@ -2969,6 +2979,7 @@ static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
SelectClipRgn(hDC, textRegion); SelectClipRgn(hDC, textRegion);
DeleteObject(textRegion); DeleteObject(textRegion);
} }
FillRect(hDC, &textRect, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
BUTTON_DrawThemedLabel(infoPtr, hDC, dtFlags, &imageRect, &textRect, theme, part, state); BUTTON_DrawThemedLabel(infoPtr, hDC, dtFlags, &imageRect, &textRect, theme, part, state);
} }
......
...@@ -848,7 +848,7 @@ static void test_themed_background(void) ...@@ -848,7 +848,7 @@ static void test_themed_background(void)
{WC_BUTTONA, BS_RADIOBUTTON, radiobutton_seq}, {WC_BUTTONA, BS_RADIOBUTTON, radiobutton_seq},
{WC_BUTTONA, BS_3STATE, checkbox_seq}, {WC_BUTTONA, BS_3STATE, checkbox_seq},
{WC_BUTTONA, BS_AUTO3STATE, 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_USERBUTTON, pushbutton_seq},
{WC_BUTTONA, BS_AUTORADIOBUTTON, radiobutton_seq}, {WC_BUTTONA, BS_AUTORADIOBUTTON, radiobutton_seq},
{WC_BUTTONA, BS_PUSHBOX, radiobutton_seq, TRUE}, {WC_BUTTONA, BS_PUSHBOX, radiobutton_seq, TRUE},
...@@ -962,7 +962,6 @@ static void test_themed_background(void) ...@@ -962,7 +962,6 @@ static void test_themed_background(void)
/* WM_CTLCOLORSTATIC is used to fill text background */ /* WM_CTLCOLORSTATIC is used to fill text background */
color = GetPixel(hdc, 10, 10); color = GetPixel(hdc, 10, 10);
todo_wine
ok(color == 0x808080, "Expected color %#x, got %#x.\n", 0x808080, color); ok(color == 0x808080, "Expected color %#x, got %#x.\n", 0x808080, color);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment