1个回答
展开全部
Option Explicit
Dim bMove As Boolean '判断可不可以移动
Dim oldX!, oldY! '!是Single的缩写
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bMove Then
Image1.Left = Image1.Left - oldX + X
Image1.Top = Image1.Top - oldY + Y
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '1就是鼠标左键
bMove = Not bMove
oldX = X
oldY = Y
End If
End Sub
Dim bMove As Boolean '判断可不可以移动
Dim oldX!, oldY! '!是Single的缩写
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bMove Then
Image1.Left = Image1.Left - oldX + X
Image1.Top = Image1.Top - oldY + Y
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '1就是鼠标左键
bMove = Not bMove
oldX = X
oldY = Y
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询