From Xojo Documentation
Draws a polygon using the values in the 1-based array passed as the X and Y coordinates. The polygon is drawn in the current color (specified by ForeColor). Odd numbered array elements are X coordinates and even numbered array elements are Y coordinates.
Polygons are drawn using the DrawPolygon and FillPolygon methods of the WebGraphics class. Polygons are drawn by passing the DrawPolygon or FillPolygon method an Integer array that contains each point in the polygon. This is a 1-based array where odd numbered array elements contain X values and even numbered array elements contain Y coordinates. This means that element 1 contains the X coordinate of the first point in the polygon and element 2 contains the Y coordinate of the first point in the polygon. Consider the following array values:
When passed to the DrawPolygon or FillPolygon method, this array would draw a polygon by drawing a line starting at 10,5 and ending at 40,40 then drawing another line starting from 40,40 ending at 5,60 and finally a line from 5,60 back to 10,5 to complete the polygon. This polygon has only three sets of coordinates so it is a triangle.
This code is in the Paint event of a WebCanvas control:
points(1) = 10
points(2) = 5
points(3) = 40
points(4) = 40
points(5) = 5
points(6) = 60
FillPolygon draws the same polygon but with the interior filled with the ForeColor:
Another way of populating the array is with the Array function. The Array function takes a list of values separated by commas and populates the array, beginning with element zero. Since the first element that DrawPolygon uses is element 1, you can use any value in element zero. This code is in the Paint event.