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

# Polygon

Draws a Polygon.

## Declaration

Source position: winapih.inc line 213

`function Polygon(`
`DC: HDC;`
`Points: PPoint;`
`NumPts: Integer;`
`Winding: Boolean`
`):Boolean;`

## Description

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. 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 it, use the Polyline method, specifying the first point a second time at the end.