From 9efcbd113d37e84edd802640187b23bd8f126fe0 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 22 Aug 2016 08:58:31 +0100 Subject: [PATCH] user32: Scale the button size with screen resolution. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/button.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/dlls/user32/button.c b/dlls/user32/button.c index b8a1cee35f2..166b1a4e150 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -143,10 +143,6 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] = OB_Paint /* BS_OWNERDRAW */ }; -static HBITMAP hbitmapCheckBoxes = 0; -static WORD checkBoxWidth = 0, checkBoxHeight = 0; - - /********************************************************************* * button class descriptor */ @@ -243,14 +239,6 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, break; case WM_CREATE: - if (!hbitmapCheckBoxes) - { - BITMAP bmp; - hbitmapCheckBoxes = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CHECKBOXES)); - GetObjectW( hbitmapCheckBoxes, sizeof(bmp), &bmp ); - checkBoxWidth = bmp.bmWidth / 4; - checkBoxHeight = bmp.bmHeight / 3; - } if (btn_type >= MAX_BTN_TYPE) return -1; /* abort */ @@ -851,7 +839,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action ) { RECT rbox, rtext, client; HBRUSH hBrush; - int delta, text_offset; + int delta, text_offset, checkBoxWidth, checkBoxHeight; UINT dtFlags; HFONT hFont; LONG state = get_button_state( hwnd ); @@ -868,6 +856,9 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action ) GetClientRect(hwnd, &client); rbox = rtext = client; + checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1; + checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1; + if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont ); GetCharWidthW( hDC, '0', '0', &text_offset ); text_offset /= 2; -- 2.11.4.GIT