mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 03:57:23 +01:00
fixed autosize of Checkbox
git-svn-id: trunk@7960 -
This commit is contained in:
parent
b28e93cbd6
commit
c67e75e666
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user