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

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-02-09 16:45:23 +08:00 committed by Alexandre Julliard
parent c69d3bb781
commit cb3b982148
2 changed files with 13 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);
}