Thintwindow: using the same function to calculate the size and for painting, bug #1680

git-svn-id: trunk@9774 -
This commit is contained in:
mattias 2006-08-31 18:33:13 +00:00
parent 5aba460c97
commit c84cbe3ffb
2 changed files with 6 additions and 18 deletions

View File

@ -42,7 +42,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls, LCLType,
Printers, OsPrinters in '../osprinters.pas', CUPSDyn;
Printers, OsPrinters, CUPSDyn;
type

View File

@ -83,23 +83,11 @@ begin
ARect := ClientRect;
Canvas.Brush.Color := Color;
Canvas.Pen.Width := 1;
//debugln('THintWindow.Paint A ',dbgs(ARect));
DrawEdge(Canvas.Handle, ARect, BDR_RAISEDOUTER, BF_RECT);
InflateRect(ARect,-2*HintBorderWidth,-2*HintBorderWidth);
//debugln('THintWindow.Paint B ',dbgs(ARect));
with TS do
begin
Alignment := taCenter;
Layout := tlCenter;
SingleLine := false;
Clipping := true;
ExpandTabs := true;
ShowPrefix := false;
WordBreak := true;
Opaque := false;
SystemFont := false;
end;
Canvas.TextRect(ARect, ARect.Left, ARect.Top, Caption, TS);
DrawText(Canvas.GetUpdatedHandle([csFontValid]),
PChar(Caption), Length(Caption), ARect,
DT_NOPREFIX or DT_CENTER or DT_VCENTER or DT_WORDBREAK);
end;
procedure THintWindow.ActivateHint(ARect: TRect; const AHint: String);
@ -138,10 +126,10 @@ end;
function THintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String;
AData: Pointer): TRect;
begin
Result := Rect(0,0, MaxWidth, ClientHeight);
Result := Rect(0,0, MaxWidth, Screen.Height-4*HintBorderWidth);
if AHint='' then exit;
DrawText(Canvas.GetUpdatedHandle([csFontValid]), PChar(AHint), Length(AHint),
Result, DT_CalcRect or DT_NOPREFIX);
Result, DT_CalcRect or DT_NOPREFIX or DT_WORDBREAK);
inc(Result.Right,4*HintBorderWidth);
inc(Result.Bottom,4*HintBorderWidth);
//debugln('THintWindow.CalcHintRect Result=',dbgs(Result));