PolyPolyline Function

Declare Function PolyPolyline Lib "gdi32.dll" (ByVal hdc As Long, lppt As POINT_TYPE, lpdwPolyPoints As Long, ByVal cCount As Long) As Long

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

PolyPolyline draws multiple sets of lines connecting points on a graphics-capable device. This function has a similar effect as using Polyline with various sets of points. Lines are drawn to connect the first point in a set to the second point, the second point to the third, etc. The first and last points in a set are not connected, just as the sets are not connected to each other. All of the points go into an array passed as lppt. The connecting lines are drawn in the object's current drawing color. The function returns 1 if successful, or 0 if an error occured.

hdc
The device context of the device to draw the lines on.
lppt
An array holding all of the points in every set. This should have all of the points in the first set, followed by those in the second set, followed by those in the third set, etc.
lpdwPolyPoints
An array identifying how many points belong to each set. The first element specified how many points are in the first set, etc.
cCount
The number of elements in lpdwPolyPoints.

Example:

' Draw a red triangle and a red parallelogram on window Form1.  The
' triangle has corners (100,100), (200,150), and (0,150).  The parallelogram has corners
' (300,300), (400,300), (350,400), and (250,400).  Note that since the first and last points
' are not connected, the beginning point is also specified as the last point in order
' to close the figures.
Dim points(0 To 8) As POINT_TYPE  ' the points in both sets
Dim numpoints(0 To 1) As Long  ' the number of points in each set
Dim retval As Long  ' return value

' Load the points for the triangle into the array.  The point (100,100) is both the first
' and last points in order to close the figure.
points(0).x = 100: points(0).y = 100  ' point #0: (100,100)
points(1).x = 200: points(1).y = 150  ' point #1: (200,150)
points(2).x = 0: points(2).y = 150  ' point #2: (0,150)
points(3).x = 100: points(3).y = 100  ' point #3: (100,100)
numpoints(0) = 4  ' number of points in first set

' Load the points for the parallelogram in a similar fashion.
points(4).x = 300: points(4).y = 300  ' point #4: (300,300)
points(5).x = 400: points(5).y = 300  ' point #5: (400,300)
points(6).x = 350: points(6).y = 400  ' point #6: (350,400)
points(7).x = 250: points(7).y = 400  ' point #7: (250,400)
points(8).x = 300: points(8).y = 300  ' point #8: (300,300)
numpoints(1) = 5  ' number of points in second set

' Now, finally draw both sets of points.  The two are not mutually connected.
Form1.ForeColor = RGB(255, 0, 0)  ' set Form1's drawing color to red
retval = PolyPolyline(Form1.hDC, points(0), numpoints(0), 2)  ' draw the lines

See Also: LineTo, Polyline, PolylineTo
Category: Lines & Curves

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/polypolyline.html