mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 00:40:03 +02:00
TextRect clipping patch from Jesus
git-svn-id: trunk@7186 -
This commit is contained in:
parent
93764b38a9
commit
dcefb8d97e
@ -1953,7 +1953,6 @@ begin
|
||||
// What a dilema!, we need ssAutoHorizontal and ssVertical!!!
|
||||
ScrolLBars:=ssBoth;
|
||||
DefaultTextStyle.Wordbreak := False;
|
||||
DefaultTextStyle.Layout := tlCenter;
|
||||
|
||||
DefaultRowHeight := 18;
|
||||
end;
|
||||
@ -2393,6 +2392,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 2005/05/21 13:24:58 mattias
|
||||
TextRect clipping patch from Jesus
|
||||
|
||||
Revision 1.40 2005/05/02 08:35:42 mattias
|
||||
fix bug 878 (can not paste from clipboard) new property TitleStyle from Jesus
|
||||
|
||||
|
@ -964,13 +964,14 @@ procedure TCanvas.TextRect(ARect: TRect; X, Y : Integer; const Text : String;
|
||||
var
|
||||
Options : Longint;
|
||||
fRect : TRect;
|
||||
DCIndex: Integer;
|
||||
begin
|
||||
//debugln('TCanvas.TextRect A Text="',Text,'" ',dbgs(ARect));
|
||||
Changing;
|
||||
Options := 0;
|
||||
case Style.Alignment of
|
||||
taRightJustify : Options := DT_RIGHT;
|
||||
taCenter : Options := DT_Center;
|
||||
taCenter : Options := DT_CENTER;
|
||||
end;
|
||||
case Style.Layout of
|
||||
tlCenter : Options := Options or DT_VCENTER;
|
||||
@ -1002,6 +1003,7 @@ begin
|
||||
fRect.Left := X;
|
||||
if Style.Layout = tlTop then
|
||||
fRect.Top := Y;
|
||||
|
||||
if (Style.Alignment in [taRightJustify,taCenter])
|
||||
or (Style.Layout in [tlCenter,tlBottom]) then begin
|
||||
DrawText(Self.Handle,pChar(Text),Length(Text),fRect,DT_CALCRECT or Options);
|
||||
@ -1015,14 +1017,30 @@ begin
|
||||
tlBottom : OffsetRect(fRect, 0, ARect.Bottom - fRect.Bottom);
|
||||
end;
|
||||
end;
|
||||
|
||||
if Style.Clipping then begin
|
||||
DCIndex := SaveDC(Self.Handle);
|
||||
IntersectRect(ARect, ARect, fRect);
|
||||
with ARect do
|
||||
InterSectClipRect(Self.Handle, Left, Top, Right, Bottom);
|
||||
Options := Options or DT_NOCLIP; // no clipping as we are handling it here
|
||||
end;
|
||||
|
||||
If Style.Opaque then begin
|
||||
RequiredState([csHandleValid, csBrushValid]);
|
||||
FillRect(fRect);
|
||||
end;
|
||||
|
||||
If Style.SystemFont then
|
||||
SetTextColor(Self.Handle, Font.Color);
|
||||
//debugln('TCanvas.TextRect DRAW Text="',Text,'" ',dbgs(fRect));
|
||||
DrawText(Self.Handle, pChar(Text), Length(Text), fRect, Options);
|
||||
|
||||
if Style.Clipping then begin
|
||||
if DCIndex <> -1 then
|
||||
RestoreDC(Self.Handle, DCIndex);
|
||||
end;
|
||||
|
||||
Changed;
|
||||
end;
|
||||
|
||||
@ -1537,6 +1555,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.94 2005/05/21 13:24:58 mattias
|
||||
TextRect clipping patch from Jesus
|
||||
|
||||
Revision 1.93 2005/05/18 09:12:21 mattias
|
||||
fixed retrieving TCanvas.Width/Height
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user