[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCanvas.Polygon

Draws a closed, many-sided shape using the Pen for the canvas.

## Declaration

Source position: graphics.pp line 1142

`public procedure TCanvas.Polygon(`
`const Points: array of TPoint;`
`Winding: Boolean;`
`StartIndex: Integer = 0;`
`NumPts: Integer = - 1`
`); procedure TCanvas.Polygon(`
`Points: PPoint;`
`NumPts: Integer;`
`Winding: Boolean = False`
`); virtual; procedure TCanvas.Polygon(`
`const Points: array of TPoint`
`);`

## Description

Use Polygon to draw a closed, many-sided shape on the canvas, using the Pen for the canvas. After drawing the complete shape, Polygon fills the shape using the canvas Brush.

The Points parameter is an array of points that give the vertices of the polygon.

Winding determines how the polygon is filled. When Winding is True, Polygon fills the shape using the Winding fill algorithm.

When Winding is False, Polygon uses the even-odd (alternative) fill algorithm.

StartIndex gives the index of the first point in the array to use. All points before this are ignored.

NumPts indicates the number of points to use, starting at StartIndex.

If NumPts is -1 (the default), Polygon uses all points from StartIndex to the end of the array. The first point is always connected to the last point.

To draw a polygon on the canvas without filling the internal area, use the Polyline method specifying the first point a second time at the end of the line.

## See also

TCanvas.PolyLine |  | Draws a line which connects a set of points on the canvas.