VB Code:
Option Explicit
Private Sub Command1_Click()
ExtendLine 1476, 1253, 3269, 2387
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.Line (1476, 1253)-(3269, 2387)
End Sub
Private Sub ExtendLine(ByVal x1 As Integer, _
ByVal Y1 As Integer, ByVal X2 As Integer, _
ByVal Y2 As Integer)
Dim x As Integer
Dim y As Integer
x = Abs(x1 - X2)
y = Abs(Y1 - Y2)
Do
Me.Cls
x1 = x1 - x
Y1 = Y1 - y
Me.Line (x1, Y1)-(X2, Y2)
Loop While x1 > 0 And Y1 > 0
Do
Me.Cls
X2 = X2 + x
Y2 = Y2 + y
Me.Line (x1, Y1)-(X2, Y2)
Loop While X2 < Me.Width And Y2 < Me.Height
End Sub