TPolygonShape
TPolygonShape
Is it possible, at this time, to apply an image to a TPolygonShape, with imagealignment of iaCenter and have the image fill out just within the boundaries of the polygon, rather than creating a rectangle?
Re: TPolygonShape
Hi mendelo,
Take a look at the following example:
Take a look at the following example:
Code: Select all
uses TeCanvas;
procedure TForm1.FormCreate(Sender: TObject);
begin
PolygonShape1.ImageAlignment := iaCenter;
PolygonShape1.Image.LoadFromFile('C:\tmp\yourPicture.bmp');
end;
procedure TForm1.Tree1AfterDraw(Sender: TObject);
begin
Tree1.Canvas.UnClipRectangle;
end;
procedure TForm1.Tree1BeforeDraw(Sender: TObject);
var i: Integer;
c: Integer;
p: array of TPoint;
begin
c:=PolygonShape1.Points.Count;
SetLength(p, c);
for i:=0 To c-1 do
p[i] := TeePoint(PolygonShape1.Points.Point[i].X,
PolygonShape1.Points.Point[i].Y);
Tree1.Canvas.ClipPolygon(p, c);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TPolygonShape
Thank you Yeray
That does work, but only temporarily. If you perform any other change to the TTree, such as turn off the grid etc. then the image reverts back to a rectangle. Additionally it does weird things to other TTreeNodeShapes, such as causing the images not to display within all other shapes.
Thanks
That does work, but only temporarily. If you perform any other change to the TTree, such as turn off the grid etc. then the image reverts back to a rectangle. Additionally it does weird things to other TTreeNodeShapes, such as causing the images not to display within all other shapes.
Thanks