- M -


MoveToEx Function

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

MoveToEx sets the current point of a graphical object. The current point is the starting point from which graphics API calls ending with "To" begin drawing from. This is the same general idea as being able to omit the first (x,y) pair in VB's Line method -- it draws from the last point referenced. Also, any graphics API functions ending with "To" almost always set the current point of the object to the last point drawn to. MoveToEx also returns the former current point in lpPoint. You can safely ignore the value returned.
hdcThe device context of the control to reference.
xThe x coordinate of the point to set as the current point.
yThe y coordinate of the point to set as the current point.
lpPointReceives the coordinate of the former current point.
Example:
  'Draw a line from (0,0) to (100,100) in Form1
  'The LineTo function starts from the current point, so we have to first
  'set the current point to (0,0). Notice how lpPoint can be ignored.
  Dim old As POINTAPI
  x = MoveToEx(Form1.hDC, 0, 0, old) 'set current point
  x = LineTo(Form1.hDC, 100, 100) 'draws from (0,0)


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