- L -


LineTo Function

Declare Function LineTo Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long

LineTo draws a line from the current point to the point specified on a graphical object. The line is drawn in the object's .ForeColor property. After the line is drawn, the endpoint specified is the new current point. This command is similar to Visual Basic's intrinsic Line method. Keep in mind that, because of the technique used by Windows to draw lines, the pixel that is the specified endpoint itself is not colored and is not considered part of the line. Don't ask me why this is done, but it also happens with VB's Line method. You can safely ignore the value returned.
hdcThe device context of the graphical object to draw on.
xThe x coordinate of the endpoint to draw to.
yThe y coordinate of the endpoint to draw to.
Example:
  'Draw a red line from (0, 40) to (100, 50) on Form1
  Dim r As POINTAPI 'for MoveToEx function
  Form1.ForeColor = RGB(255, 0, 0) 'red
  x = MoveToEx(Form1.hdc, 0, 40, r) 'set the current point to (0, 40)
  x = LineTo(Form1.hdc, 100, 50) 'draw from (0, 40) to (100, 50)


Category: Graphics
Back to the index.


Home
Paul Kuliniewicz
E-mail: Borg953@aol.com
All material presented on these pages is Copyright © Paul Kuliniewicz, except for other copyrighted material.
http://members.aol.com/Borg953/api/l.html