Declare Function Polygon Lib "gdi32.dll" (ByVal hdc As Long, lpPoint As POINT_TYPE, ByVal nCount As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
Polygon draws and fills a polygon on a device. The polygon is drawn using the current pen and is filled using the current brush. The vertices of the polygon are stored in an array passed as lpPoint, in sequential order. Only specify each point once. The function returns 1 if successful, or 0 if an error occured.
Example:
' Draw a diamond on window Form1 using the default pen and
' brush. Note how the points must be loaded into the array before calling the function.
Dim points(0 To 3) As POINT_TYPE ' vertices of the polygon
Dim retval As Long ' return value
' Load the coordinates of the diamond's vertices into the array.
points(0).x = 200: points(0).y = 100 ' 1st point (200,100)
points(1).x = 250: points(1).y = 150 ' 2nd point (250,150)
points(2).x = 200: points(2).y = 200 ' 3rd point (200,200)
points(3).x = 150: points(3).y = 150 ' 4th point (150,150)
' Draw the diamond using Form1's default pen and brush
retval = Polygon(Form1.hDC, points(0), 4) ' four points in the array
Related Call: PolyPolygon
Category: Filled Shapes
Back to the index.