یک دانه picture1 بگذارید و کد را داخل برنامه کپی کنید



Dim xX, Yy, xXx, yYy, PrEsS As Integer


Private Sub picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xXx = xX
yYy = Yy
PrEsS = 1
End Sub


Private Sub picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
PrEsS = 0
End Sub


Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
xX = X
Yy = Y
If PrEsS = 1 Then
Picture1.Left = Picture1.Left + xX - xXx
Picture1.Top = Picture1.Top + Yy - yYy
End If
End Sub