PolyPolygon Function

Declare Function PolyPolygon Lib "gdi32.dll" (ByVal hdc As Long, lpPoint As POINT_TYPE, lpPolyCounts As Long, ByVal nCount As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

PolyPolygon draws multiple polygons on a given device. The polygons are drawn using the device's current pen and are filled using the device's current brush. The various polygons are not connected. The vertices of every polygon are stored in an array passed as lpPoint. The array passed as lpPolyCounts identifies the number of vertices in each polygon. This function is equivalent to calling the Polygon function multiple times. The function returns 1 if successful, or 0 if an error occured.

hdc
A device context to the device to draw the polygons on.
lpPoint
An array holding all of the vertices of every polygon to draw, listed in their proper order. Do not specify any point more than once in each polygon's set of vertices.
lpPolyCounts
An array holding the number of points in lpPoint belonging to each polygon. For example, lpPolyCounts(0) identifies the number of points belonging to the first polygon, etc.
nCount
The number of elements in the array passed as lpPolyCounts.

Example:

' Draw a diamond and a triangle on window Form1.  The two
' polygons are not interconnected and are drawn using the window's current pen
' and brush.  Note how the two arrays delineate each polygon's set of vertices.
Dim points(0 To 6) As POINT_TYPE  ' holds diamond's and triangle's vertices
Dim numpoints(0 To 1) As Long  ' holds number of points belonging to each polygon
Dim retval As Long  ' return value

' Load the points belonging to the diamond.
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)
numpoints(0) = 4  ' first four points identify the diamond

' Load the points belonging to the triangle.
points(4).x = 350: points(4).y = 200  ' 1st point: (350,200)
points(5).x = 400: points(5).y = 250  ' 2nd point: (400,250)
points(6).x = 300: points(6).y = 250  ' 3rd point: (300,250)
numpoints(1) = 3  ' next three points identify the triangle

' Draw the two polygons
retval = PolyPolygon(Form1.hDC, points(0), numpoints(0), 2)  ' two polygons

See Also: Polygon
Category: Filled Shapes

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/p/polypolygon.html