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:
paul 2009-01-03 16:23:13 +00:00
parent 873d02994c
commit 3657fbfe4f

View File

@ -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);