I want to be able to draw polygons on a tcanvas.
The points will be taken from a database table and the number of points in the polygon will not be known until run time and will vary.
Since the polygon routine uses an array of Tpoint, is there a way of creating such an array by adding to it a point at a time, as is possible with a variant array?
Is there an equivalent of the following logic
eg for a variant array
var
poly: variant;
.
procedure pr_polyinit(bcolor:tcolor;
bstyle:tbr
ushstyle);
begin
pr_brushcolor(bcolor); {set brush properties}
pr_brushstyle(bstyle);
poly:=varraycreate([0,0],v
arvariant)
; <===== cant create an array of type tpoint
np:=-1;
end;
procedure pr_polyadd(x,y:integer);
begin
np:=np+1;
poly[np]:=point(x,y); <==================can't set a variant element to a tpoint
end;
procedure pr_polygon;
begin
prcanvas.Polygon(poly); <===== can't pass a variant array to polygon, needs array of tpoint
end;
Start Free Trial