Declare Function LineTo Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long) As Long
Declare Function MoveToEx Lib "gdi32.dll" _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
lpPoint As POINT_TYPE) As Long
Type POINT_TYPE
x As Long
y As Long
End Type
'Draw a red line from (0,40) to (100,50) on Form1
Dim udtPT As POINT_TYPE 'receives the former current point
Dim lngRtn As Long 'return value
'set the drawing color of Form1 to red
Form1.ForeColor = RGB(255, 0, 0)
'set the current point to (0,40)
lngRtn = MoveToEx(Form1.hdc, 0, 40, udtPT)
'Draw the line to (100,50)
lngRtn = LineTo(Form1.hdc, 100, 50)