fixed AutoSize of TCustomLabel and TButtonControl with & in the caption (issue #1799)

git-svn-id: trunk@8861 -
This commit is contained in:
vincents 2006-03-02 20:10:37 +00:00
parent 340a6fcb24
commit d6b62f2146
2 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,7 @@ begin
try
R := Rect(0,0, Width, Height);
OldFont:=SelectObject(DC, Font.Handle);
Flags:=DT_CalcRect or DT_NoPrefix;
Flags:=DT_CalcRect;
if WordWrap then inc(Flags,DT_WordBreak);
DrawText(DC, PChar(Caption), Length(Caption), R, Flags);
SelectObject(DC, OldFont);

View File

@ -1106,6 +1106,7 @@ begin
winHandle := AWinControl.Handle;
canvasHandle := GetDC(winHandle);
oldFontHandle := SelectObject(canvasHandle, Windows.SendMessage(winHandle, WM_GetFont, 0, 0));
DeleteAmpersands(Text);
Result := Windows.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize);
if Result then
begin