Polyline Function

Declare Function Polyline 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

Polyline draws a series of lines on a graphics-capable device. These lines connect the points given in an array passed as lpPoint. Lines are drawn connecting the first point to the second point, the second point to the third point, etc. The first and last points are not connected. The lines are drawn using the device'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.
lpPoint
An array specifying the x and y coordinates of each point to draw lines to or from.
nCount
The number of elements in the array passed as lpPoint.

Example:

' Draw a triangle having corners (100,100), (200, 150), and (0, 150)
' on window Form1.  Note how since we want the first and last points to be connected,
' point (100,100) must be given as both the first and last points.
Dim points(0 To 3) As POINT_API  ' the points to draw to/from
Dim retval As Long  ' return value

' Put the points to use into the array.  Four points must be specified to draw the
' triangle because the point (100,100) must be entered twice.
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)

Form1.ForeColor = RGB(255, 0, 0)  ' set Form1's drawing color to red
retval = Polyline(Form1.hDC, points(0), 4)  ' draw the lines

See Also: LineTo, PolylineTo, PolyPolyline
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/polyline.html