4个回答
2013-06-15
展开全部
***版本一***左键单击后可以移动,再次单击停止移动:
Dim bMove As Boolean '判断可不可以移动
Dim oldX!, oldY! '!是Single的缩写
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bMove Then
Command1.Left = Command1.Left - oldX + X
Command1.Top = Command1.Top - oldY + Y
End If
End Sub
Private Sub Command1_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 oldX!, oldY! '!是Single的缩写
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '1就是鼠标左键
oldX = X
oldY = Y
End If
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Command1.Left = Command1.Left - oldX + X
Command1.Top = Command1.Top - oldY + Y
End If
End Sub
Dim bMove As Boolean '判断可不可以移动
Dim oldX!, oldY! '!是Single的缩写
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bMove Then
Command1.Left = Command1.Left - oldX + X
Command1.Top = Command1.Top - oldY + Y
End If
End Sub
Private Sub Command1_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 oldX!, oldY! '!是Single的缩写
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '1就是鼠标左键
oldX = X
oldY = Y
End If
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Command1.Left = Command1.Left - oldX + X
Command1.Top = Command1.Top - oldY + Y
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-06-15
展开全部
在按钮的鼠标按下事件里写...if button = 1 then if 按钮.Eanble = True then 按钮.Eanble = False 按钮.Left = X: 按钮.Top = Y else 按钮.Eanble = True end ifend if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-06-15
展开全部
SendMessageA(按钮的句柄,161.2.0)这个事API命令,在易语言里直接按钮.发送信息(161.2.0)就可以实现的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-06-15
展开全部
如果,怎样~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询