[PATCH 3/4] user32: The offset between the button and the text is half the digit width.
Huw Davies
huw at codeweavers.com
Mon Aug 22 02:58:30 CDT 2016
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/user32/button.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 5ed9c92..b8a1cee 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -851,7 +851,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
{
RECT rbox, rtext, client;
HBRUSH hBrush;
- int delta;
+ int delta, text_offset;
UINT dtFlags;
HFONT hFont;
LONG state = get_button_state( hwnd );
@@ -869,6 +869,8 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
rbox = rtext = client;
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
+ GetCharWidthW( hDC, '0', '0', &text_offset );
+ text_offset /= 2;
parent = GetParent(hwnd);
if (!parent) parent = hwnd;
@@ -881,14 +883,12 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if (style & BS_LEFTTEXT)
{
- /* magic +4 is what CTL3D expects */
-
- rtext.right -= checkBoxWidth + 4;
+ rtext.right -= checkBoxWidth + text_offset;
rbox.left = rbox.right - checkBoxWidth;
}
else
{
- rtext.left += checkBoxWidth + 4;
+ rtext.left += checkBoxWidth + text_offset;
rbox.right = checkBoxWidth;
}
--
2.8.2
More information about the wine-patches
mailing list