Declare Function PolylineTo Lib "gdi32.dll" (ByVal hdc As Long, lppt As POINT_TYPE, ByVal cCount As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
PolylineTo draws a series of connected lines on a graphics-capable device. The points are given to the function inside an array passed as lppt. The function draws lines connecting the device's current point to the first point, the first point to the second point, the second point to the third point, etc. When the function is finished, it sets the current point to whatever the last point in the array is. The original current point and the last point are not connected. The lines are drawn in the device's current drawing color. The function returns 1 if successful, or 0 if an error occured.
Example:
' Draw a red triangle with corners (100,100), (200,150), and (0,150)
' on window Form1. The current point must first be set to (100,100), and the last
' point must also be given as (100,100) to close the triangle.
Dim points(0 To 2) As POINT_TYPE ' points given to the function
Dim curpt As POINT_TYPE ' receives current point from MoveToEx
Dim retval As Long ' return value
' Set Form1's current point to (100,100)
retval = MoveToEx(Form1.hDC, 100, 100, curpt)
' Load the points of the triangle into the array points(). Notice that (100,100)
' is given as the last point to close the figure.
points(0).x = 200: points(0).y = 150 ' point #0: (200,150)
points(1).x = 0: points(1).y = 150 ' point #1: (0,150)
points(2).x = 100: points(2).y = 100 ' point #2: (100,100)
Form1.ForeColor = RGB(255, 0, 0) ' set Form1's drawing color to red
retval = PolylineTo(Form1.hDC, points(0), 3) ' draw the lines
See Also: LineTo, Polyline, 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/polylineto.html