Yes, just define as Array of TPoint, giving you a dynamic array that you can resize using SetLength.
Regards,
Russell
--- example usage ---
var Poly: Array of TPoint;
begin
// Allocate dynamic array of TPoint
SetLength(Poly, 6);
// Set array elements
Poly[0]:=Point(10, 10);
Poly[1]:=Point(30, 5);
Poly[2]:=Point(100, 20);
Poly[3]:=Point(120, 100);
Poly[4]:=Point(50, 120);
Poly[5]:=Point(10, 60);
// Pass to drawing routine
Canvas.Polygon(Poly);
// Redim if needed
SetLength(Poly, 7);
Poly[6]:=Point(1,5);
// Pass to drawing routine
Canvas.Polygon(Poly);
end;
Main Topics
Browse All Topics





by: KymberleyPosted on 2008-01-12 at 06:45:47ID: 20643936
for variant arrays the routine should had a redim line as well
procedure pr_polyadd(x,y:integer);
begin
np:=np+1;
vararrayredim(poly,np);
poly[np]:=point(x,y); <==================can't set a variant element to a tpoint
end;