user32: The offset between the button and the text is half the digit width.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-08-22 08:58:30 +01:00 committed by Alexandre Julliard
parent 94a87819c5
commit b0ec8a6675

View File

@ -851,7 +851,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
{ {
RECT rbox, rtext, client; RECT rbox, rtext, client;
HBRUSH hBrush; HBRUSH hBrush;
int delta; int delta, text_offset;
UINT dtFlags; UINT dtFlags;
HFONT hFont; HFONT hFont;
LONG state = get_button_state( hwnd ); LONG state = get_button_state( hwnd );
@ -869,6 +869,8 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
rbox = rtext = client; rbox = rtext = client;
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
GetCharWidthW( hDC, '0', '0', &text_offset );
text_offset /= 2;
parent = GetParent(hwnd); parent = GetParent(hwnd);
if (!parent) parent = hwnd; if (!parent) parent = hwnd;
@ -881,14 +883,12 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if (style & BS_LEFTTEXT) if (style & BS_LEFTTEXT)
{ {
/* magic +4 is what CTL3D expects */ rtext.right -= checkBoxWidth + text_offset;
rtext.right -= checkBoxWidth + 4;
rbox.left = rbox.right - checkBoxWidth; rbox.left = rbox.right - checkBoxWidth;
} }
else else
{ {
rtext.left += checkBoxWidth + 4; rtext.left += checkBoxWidth + text_offset;
rbox.right = checkBoxWidth; rbox.right = checkBoxWidth;
} }