From c67e75e66612525b543134ccc447f2b755053d0b Mon Sep 17 00:00:00 2001 From: vincents Date: Wed, 12 Oct 2005 14:46:05 +0000 Subject: [PATCH] fixed autosize of Checkbox git-svn-id: trunk@7960 - --- lcl/interfaces/win32/win32proc.pp | 2 +- lcl/interfaces/win32/win32wsstdctrls.pp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index f8c6799284..516539c099 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -1071,7 +1071,7 @@ var begin winHandle := AWinControl.Handle; canvasHandle := GetDC(winHandle); - oldFontHandle := SelectObject(canvasHandle, AWinControl.Font.Handle); + oldFontHandle := SelectObject(canvasHandle, Windows.SendMessage(winHandle, WM_GetFont, 0, 0)); Result := Windows.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize); if Result then begin diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index 3a63727b25..8c8c7f4dc3 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -1023,9 +1023,9 @@ var begin if MeasureText(AWinControl, AWinControl.Caption, PreferredWidth, PreferredHeight) then begin - // ~5 pixels spacing between checkbox and text, and 2 pixels margin for rounding error - Inc(PreferredWidth, GetSystemMetrics(SM_CXMENUCHECK) - GetSystemMetrics(SM_CXBORDER) + 7); - iconHeight := GetSystemMetrics(SM_CYMENUCHECK) - GetSystemMetrics(SM_CYBORDER); + // 7 pixels spacing between checkbox and text + Inc(PreferredWidth, GetSystemMetrics(SM_CXMENUCHECK) + 7); + iconHeight := GetSystemMetrics(SM_CYMENUCHECK); if iconHeight > PreferredHeight then PreferredHeight := iconHeight; end;