(X - X0) (Y - X0)
--------- = ---------
(X1 - X0) (Y1 - Y0)
_П_
\ /
V
(X1 - X0)*(Y - Y0)
X = -------------------
(Y1 - Y0)
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
With Line1
MyX = (.X1 - .X2) * (Y - .Y2) / (.Y1 - .Y2) + .X2
Line (X, Y)-(.X1, .Y1)
Line (X, Y)-(.X2, .Y2)
If (Y >= .Y1 And Y <= .Y2) Or (Y <= .Y1 And Y >= .Y2) Then
Line (X, Y)-(MyX, Y)
End If
End With
Circle (MyX, Y), 20, vbRed
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
With Line1
MyX = (.X1 - .X2) * (Y - .Y2) / (.Y1 - .Y2) + .X2
Line (X, Y)-(.X1, .Y1)
Line (X, Y)-(.X2, .Y2)
If (Y >= .Y1 And Y <= .Y2) Or (Y <= .Y1 And Y >= .Y2) Then
Line (X, Y)-(MyX, Y)
End If
End With
Circle (MyX, Y), 20, vbRed
End Sub
Сейчас этот форум просматривают: AhrefsBot и гости: 158