一个很简单的例子: Dim state Dim x1 Dim y1 Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) state = 1 x1 = X y1 = Y End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If state = 1 Then Picture1.Line (x1, y1)-(X, Y) x1 = X y1 = Y End If End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) state = 0 End Sub
Dim state
Dim x1
Dim y1
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
state = 1
x1 = X
y1 = Y
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If state = 1 Then
Picture1.Line (x1, y1)-(X, Y)
x1 = X
y1 = Y
End If
End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
state = 0
End Sub