drawPolygon(points: RealArray; color: Integer);
The drawPolygon method of the Window class draws the border of a polygon on a form or control using a colored pen the width of the drawWidth property, the style of the drawStyle property, and the mode of the drawMode property. The inside of the polygon is not filled. If this method is not called from a paint event, set the autoRedraw property to true.
The drawPolygon method parameters are listed in the following table.
Parameter | Description |
---|---|
points | Pairs of left and right (x, y) points, respectively, of the polygon |
color | Color of the pen used |
The figure drawn by this polygon is equivalent to using the drawFilledPolygon method with the drawFillStyle property set to DrawFillStyle_Transparent (1), except that the start points (x1, y1) and end points (xn, yn, where the n value represents a matching set of left and right end points) are not automatically linked. You can therefore use the drawPolygon method to draw a many-sided irregular shape.
Note that there must be an even number of entries (x, y points) in the array and there must be at least two sets of points, as shown in the following example.
create realArray transient; realArray.add(x1); realArray.add(y1); realArray.add(x2); realArray.add(y2); realArray.add(x3); realArray.add(y3); drawPolygon(realArray, Black); delete realArray;