RAD Studio VCL Reference
|
Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point.
procedure Polygon(const Points: array of TPoint);
__fastcall Polygon(const array of TPoint Points);
Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the value of Brush.
The Points parameter is an array of points that give the vertices of the polygon.
Canvas.Polygon(Slice(PointArray, 10));
To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.
C++ Examples:
/* This example draws a polygon in the specified shape, and fills it with the color teal. */ void __fastcall TForm1::PaintBox1Paint(TObject *Sender) { TPoint points[4]; points[0] = Point(10,10); points[1] = Point(30,10); points[2] = Point(130,30); points[3] = Point(240,120); (dynamic_cast<TPaintBox *>(Sender))->Canvas->Brush->Color = clTeal; (dynamic_cast<TPaintBox *>(Sender))->Canvas->Polygon(points, 3); }
Delphi Examples:
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|