drawFilledPolygon

drawFilledPolygon(points: RealArray;
                  color:  Integer);

The drawFilledPolygon method of the Window class draws 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, and automatically links the start points (x1, y1) to the end points (xn, yn, where the n value represents a matching set of left and right end points). If this method is not called from a paint event, set the autoRedraw property to true.

The figure is filled using the color and style of the drawFillColor and drawFillStyle properties of the object. The drawFilledPolygon 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 position units of the points in the RealArray are values in the units of the scaleMode property of the form or control.

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);
drawFilledPolygon(realArray, Black);
delete realArray;

To draw an unfilled polygon, use the drawPolygon method or set the drawFillStyle property to DrawFillStyle_Transparent (1). Alternatively, you can use the drawPolygon method to draw a many-sided irregular shape (that is, without automatically linking the start points (x1, y1) to the end points (xn, yn, where the n value represents a matching set of left and right end points).