' See if we are over a grab handle.
Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Dim i As Integer
Dim dx As Single
Dim dy As Single
For i = 1 To m_NumPoints
If Abs(m_PointX(i) - X) < HANDLE_HALF_WIDTH And _
Abs(m_PointY(i) - Y) < HANDLE_HALF_WIDTH _
Then
' We are over this grab handle.
' Start dragging.
m_DraggingHandle = i
Exit For
End If
Next i
End Sub
' Move the drag handle.
Private Sub Form_MouseMove(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
' Do nothing if we are not dragging.
If m_DraggingHandle = 0 Then Exit Sub
' Move the handle.
m_PointX(m_DraggingHandle) = X
m_PointY(m_DraggingHandle) = Y
' Redraw.
Refresh
End Sub
' Stop dragging.
Private Sub Form_MouseUp(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
m_DraggingHandle = 0
End Sub
|