VB 让图片移动
设定四个按钮控制图像移动~~~~要MouseDown事件的~~不是点一下就动一下的~~~~要点下去一直动的~~按钮控制图片移动~~~~按下去就动~~~不按就不动!!!!就...
设定四个按钮控制图像移动~~~~要MouseDown事件的~~
不是点一下就动一下的~~~~
要点下去一直动的~~
按钮控制图片移动~~~~按下去就动~~~不按就不动!!!!
就像点按钮,控制人物在游戏里移动 展开
不是点一下就动一下的~~~~
要点下去一直动的~~
按钮控制图片移动~~~~按下去就动~~~不按就不动!!!!
就像点按钮,控制人物在游戏里移动 展开
展开全部
'以下是代码 需创建4个按钮(ommand1,ommand2,ommand3,ommand4) 和一个TIMER控件(Timer1) 一个图片框(Picture1)
不知道是不是你说的那种效果?有问题发消息, 12点了 睡觉了。。拜拜
Dim i
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 1
Timer1.Enabled = True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 2
Timer1.Enabled = True
End Sub
Private Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 3
Timer1.Enabled = True
End Sub
Private Sub Command4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 4
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Select Case i
Case 1
Picture1.Top = Picture1.Top - 10
Case 2
Picture1.Top = Picture1.Top + 10
Case 3
Picture1.Left = Picture1.Left - 10
Case 4
Picture1.Left = Picture1.Left + 10
End Select
End Sub
不知道是不是你说的那种效果?有问题发消息, 12点了 睡觉了。。拜拜
Dim i
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 1
Timer1.Enabled = True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 2
Timer1.Enabled = True
End Sub
Private Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 3
Timer1.Enabled = True
End Sub
Private Sub Command4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = 4
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Select Case i
Case 1
Picture1.Top = Picture1.Top - 10
Case 2
Picture1.Top = Picture1.Top + 10
Case 3
Picture1.Left = Picture1.Left - 10
Case 4
Picture1.Left = Picture1.Left + 10
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询