MoveToEx Function

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

Platforms: Win 32s, Win 95/98, Win NT

MoveToEx sets the current point of a device. The current point is the starting point from which all graphics APIs ending with "To" (such as LineTo) begin drawing from. Some programming languages call this point the last point referenced. This function also puts the former current point into the variable passed as lpPoint. The function returns 0 if an error occured, or 1 if successful.

hdc
The device context of the device to set the current point of.
x
The x coordinate of the point to set as the current point.
y
The y coordinate of the point to set as the current point.
lpPoint
Variable that receives the coordinate of the former current point.

Example:

' Draw a red line from (0,40) to (100,50) on the window Form1.
Dim pt As POINT_TYPE  ' receives the former current point
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)
' Note that pt now contains whatever the old current point was, but it doesn't matter here.
retval = LineTo(Form1.hdc, 100, 50)  ' draw a line from current point to (100,50)

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