mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 11:19:21 +02:00
lcl: retrieve font handle from the window handle, don't retrieve it from the LCL font when we want to measure text size of a control (bug #0012857)
git-svn-id: trunk@18079 -
This commit is contained in:
parent
873d02994c
commit
3657fbfe4f
@ -1251,11 +1251,12 @@ var
|
||||
textSize: Windows.SIZE;
|
||||
winHandle: HWND;
|
||||
canvasHandle: HDC;
|
||||
oldFontHandle: HFONT;
|
||||
oldFontHandle, newFontHandle: HFONT;
|
||||
begin
|
||||
winHandle := AWinControl.Handle;
|
||||
canvasHandle := Windows.GetDC(winHandle);
|
||||
oldFontHandle := SelectObject(canvasHandle, AWinControl.Font.Reference.Handle);
|
||||
newFontHandle := HFONT(SendMessage(winHandle, WM_GETFONT, 0, 0));
|
||||
oldFontHandle := SelectObject(canvasHandle, newFontHandle);
|
||||
DeleteAmpersands(Text);
|
||||
|
||||
Result := LCLIntf.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize);
|
||||
|
Loading…
Reference in New Issue
Block a user