VB6如何在代码中使控件移动
就是一个文本框,点第一个按钮移到一个地方,点第二个按钮使文本框向下移50,要怎么做,本人小白谢谢啦。...
就是一个文本框,点第一个按钮移到一个地方,点第二个按钮使文本框向下移50,要怎么做,本人小白谢谢啦。
展开
2个回答
展开全部
在窗口放一个按钮,在复制下面代码运行测试ok!!!
Dim xx, yy, ax, ay As Long
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
xx = X
yy = Y
End If
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
ax = Command1.Left + X
ay = Command1.Top + Y
Command1.Top = ay - yy
Command1.Left = ax - xx
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Print "你点击了按钮了"
If Button = 2 Then Print "你移动按钮了"
End Sub
Private Sub Form_Load()
Command1.Caption = "鼠标左键点击,鼠标右键移动"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询