diff options
Diffstat (limited to 'alf/alflayout.cpp')
| -rw-r--r-- | alf/alflayout.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp index 0fa3473..470f728 100644 --- a/alf/alflayout.cpp +++ b/alf/alflayout.cpp @@ -214,8 +214,6 @@ ALF_Layout_CalcCheckboxSize(HWND hwndWindow, ALFLayout *layout, HWND hwndCheckbo { (void)hwndWindow; - int checkwidth = 12 * layout->dpi / 96 + 1; - HDC hDC = GetDC(hwndCheckbox); HFONT font = (HFONT)SendMessage(hwndCheckbox, WM_GETFONT, 0, 0); HFONT oldfont = SelectFont(hDC, font); @@ -230,11 +228,24 @@ ALF_Layout_CalcCheckboxSize(HWND hwndWindow, ALFLayout *layout, HWND hwndCheckbo int cx = 0; GetCharWidth(hDC, '0', '0', &cx); + int checkwidth = 12 * layout->dpi / 96 + 1; + int checkheight = checkwidth; + + if (!ALF_Compat_IsMinWindowsVersion(4, 0)) { + // 3.x-style checkboxes have the checkmark baseline-aligned + TEXTMETRIC tm; + ZeroMemory(&tm, sizeof(tm)); + + if (GetTextMetrics(hDC, &tm)) { + checkheight += tm.tmDescent; + } + } + cx += checkwidth + r.right - r.left; int cy = r.bottom - r.top; - if (checkwidth > cy) - cy = checkwidth; + if (checkheight > cy) + cy = checkheight; if (ps->cx < cx) ps->cx = cx; |
