From RAD Studio API Documentation
Jump to: navigation, search


procedure Polygon(const Points: array of TPoint); override;


virtual void __fastcall Polygon(const System::Types::TPoint *Points, const int Points_High);


Type Visibility Source Unit Parent
Vcl.Graphics TCanvas


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.

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.

Note: The Points_Size parameter is the index of the last point in the array (one less than the total number of points).

The first point is always connected to the last point.

Note: In Delphi, you can use the Slice function to pass a portion of an array of points to the Polygon method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows:

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.

See Also

Code Examples