[PATCH 4/6] comctl32/button: Correctly align parts in group boxes with BS_PUSHLIKE when theming is off.

Zhiyi Zhang zzhang at codeweavers.com
Thu Nov 11 01:04:06 CST 2021


Parts in group boxes with BS_PUSHLIKE can be at the bottom, center and top when theming is off.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/button.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index af2fefabe2b..74de83b461a 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -1589,6 +1589,11 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
    split_style = infoPtr->imagelist.himl ? BUTTON_ILStoBS(infoPtr->imagelist.uAlign) : style;
    dtStyle = BUTTON_BStoDT(style, ex_style);
 
+   /* Group boxes are top aligned unless BS_PUSHLIKE is set and it's not themed */
+   if (get_button_type(style) == BS_GROUPBOX
+       && (!(style & BS_PUSHLIKE) || GetWindowTheme(infoPtr->hwnd)))
+       style &= ~BS_VCENTER | BS_TOP;
+
    SetRect(&imageRect, 0, 0, imageSize.cx, imageSize.cy);
    imageRectWithMargin = imageRect;
    if (infoPtr->imagelist.himl)
@@ -1670,11 +1675,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
        /* Show text only */
        else
        {
-           if (get_button_type(style) != BS_GROUPBOX)
-               BUTTON_PositionRect(style, labelRc, &textRect, textMargin);
-           else
-               /* GroupBox is always top aligned */
-               BUTTON_PositionRect((style & ~BS_VCENTER) | BS_TOP, labelRc, &textRect, textMargin);
+           BUTTON_PositionRect(style, labelRc, &textRect, textMargin);
            labelRect = textRect;
            SetRectEmpty(&imageRect);
        }
-- 
2.32.0




More information about the wine-devel mailing list