user32: Scale the button size with screen resolution.

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:31 +01:00 committed by Alexandre Julliard
parent b0ec8a6675
commit 9efcbd113d
1 changed files with 4 additions and 13 deletions

View File

@ -143,10 +143,6 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
OB_Paint /* BS_OWNERDRAW */ OB_Paint /* BS_OWNERDRAW */
}; };
static HBITMAP hbitmapCheckBoxes = 0;
static WORD checkBoxWidth = 0, checkBoxHeight = 0;
/********************************************************************* /*********************************************************************
* button class descriptor * button class descriptor
*/ */
@ -243,14 +239,6 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
break; break;
case WM_CREATE: 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) if (btn_type >= MAX_BTN_TYPE)
return -1; /* abort */ return -1; /* abort */
@ -851,7 +839,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, text_offset; int delta, text_offset, checkBoxWidth, checkBoxHeight;
UINT dtFlags; UINT dtFlags;
HFONT hFont; HFONT hFont;
LONG state = get_button_state( hwnd ); LONG state = get_button_state( hwnd );
@ -868,6 +856,9 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
GetClientRect(hwnd, &client); GetClientRect(hwnd, &client);
rbox = rtext = 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 ); if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
GetCharWidthW( hDC, '0', '0', &text_offset ); GetCharWidthW( hDC, '0', '0', &text_offset );
text_offset /= 2; text_offset /= 2;