<p>
<pre class=\\\"answer-content\\\">用的picturebox名字为 picture1复制到你的窗体就能用!前提你的变量不能与我的冲突
Option Explicit
Private tx As Long, ty As Long, tb As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then \\\'如果按鼠标左键
tb = True
tx = X
ty = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If tb Then Picture1.Move Picture1.Left X - tx, Picture1.Top Y - ty
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
tb = False
End Sub
</p>
|