Declare Function LineTo Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
LineTo draws a line from the current point to the point specified on a device. The line is drawn in the color specified by that object's .ForeColor property. After the line is drawn, the endpoint is the new current point. The algorithm Windows uses to draw a line does not actually color the last pixel of the line because it is not considered part of the line. The function returns 0 if an error occured, or 1 if successful.
Example:
' Draw a red line from (0,40) to (100,50) on the window Form1.
Dim pt As POINT_TYPE ' needed for another API function
Dim retval As Long ' return value
Form1.ForeColor = RGB(255, 0, 0) ' set the foreground drawing color of Form1 to red
retval = MoveToEx(Form1.hdc, 0, 40, pt) ' set the current point to (0,40)
retval = LineTo(Form1.hdc, 100, 50) ' draw a line from current point to (100,50)
See Also: Polyline, 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/l/lineto.html