considering this code, I expect the second rectangle to have text clipped to the inside of the rectangle, both for the bottom in vertical direction, as to the right in the horizontal direction (als perhaps also on the left when using DT_CENTER, but haven't tested it here):
uses SynPDF;
procedure TestDrawTextClipping;
var
b:TBitmap;
p:TPdfDocumentGDI;
c:TCanvas;
i:integer;
s:string;
r:TRect;
begin
//b:=TBitmap.Create;
p:=TPdfDocumentGDI.Create;
try
//b.Width:=800;b.Height:=1000;c:=b.Canvas;
p.AddPage; c:=p.VCLCanvas;
c.Lock;
try
c.Pen.Style:=psSolid;
c.Pen.Color:=clBlack;
c.Pen.Width:=1;
c.Brush.Style:=bsClear;
s:='';
for i:=0 to 7 do s:=s+'test1 test2 test3 test4 test5'#13#10;
r:=Rect(10,10,100,100);
c.Rectangle(r);
DrawText(c.Handle,PChar(s),Length(s),r,DT_LEFT or DT_NOCLIP);
r:=Rect(10,510,100,600);
c.Rectangle(r);
DrawText(c.Handle,PChar(s),Length(s),r,DT_LEFT);
finally
c.Unlock;
end;
//b.SaveToFile('test.bmp');
p.SaveToFile('test.pdf');
finally
//b.Free;
p.Free;
end;
end;
considering this code, I expect the second rectangle to have text clipped to the inside of the rectangle, both for the bottom in vertical direction, as to the right in the horizontal direction (als perhaps also on the left when using DT_CENTER, but haven't tested it here):
test.pdf