Private m_Drawing As Boolean
Private m_X1 As Single
Private m_Y1 As Single
Private m_X2 As Single
Private m_Y2 As Single
Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
m_Drawing = True
m_X1 = X
m_Y1 = Y
m_X2 = X
m_Y2 = Y
DrawMode = vbInvert
Line (m_X1, m_Y1)(m_X2, m_Y2)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
If Not m_Drawing Then Exit Sub
Line (m_X1, m_Y1)(m_X2, m_Y2)
m_X2 = X
m_Y2 = Y
Line (m_X1, m_Y1)(m_X2, m_Y2)
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
If Not m_Drawing Then Exit Sub
m_Drawing = False
Line (m_X1, m_Y1)(m_X2, m_Y2)
m_X2 = X
m_Y2 = Y
DrawMode = vbCopyPen
Line (m_X1, m_Y1)(m_X2, m_Y2)
DrawArrow m_X1, m_Y1, m_X2, m_Y2, 200
End Sub
Private Sub DrawArrow(ByVal x1 As Single, ByVal y1 As _
Single, ByVal x2 As Single, ByVal y2 As Single, ByVal _
arm_length As Single)
Dim dx As Single
Dim dy As Single
Dim length As Single
dx = x2  x1
dy = y2  y1
length = Sqr(dx * dx + dy * dy)
If length = 0 Then Exit Sub
Line (x1, y1)(x2, y2)
dx = dx / length * arm_length
dy = dy / length * arm_length
Line (x2, y2)Step(dx  dy, dy + dx)
Line (x2, y2)Step(dx + dy, dy  dx)
End Sub
