VB 单击开始 图片0.5秒随机移动一次 单击停止 图片停止移动
3个回答
展开全部
两个按钮,一个ImageBox,一个Timer
Private Sub Form_Load()
Timer1.Interval = 500
Timer1.Enabled = False
End Sub
Private Sub Command1_Click() '开始
Timer1.Enabled = True
End Sub
Private Sub Command2_Click() '停止
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Image1.Move Int(Rnd * (Me.ScaleWidth - Image1.Width)), Int(Rnd * (Me.ScaleHeight - Image1.Height))
End Sub
Private Sub Form_Load()
Timer1.Interval = 500
Timer1.Enabled = False
End Sub
Private Sub Command1_Click() '开始
Timer1.Enabled = True
End Sub
Private Sub Command2_Click() '停止
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Image1.Move Int(Rnd * (Me.ScaleWidth - Image1.Width)), Int(Rnd * (Me.ScaleHeight - Image1.Height))
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Dim rndL!, rndT!
rndL = (Rnd * (Form1.Width - Picture1.Width))
rndT = (Rnd * (Form1.Height - Picture1.Height)) * 0.8
Picture1.Left = rndL: Picture1.Top = rndT
End Sub
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Dim rndL!, rndT!
rndL = (Rnd * (Form1.Width - Picture1.Width))
rndT = (Rnd * (Form1.Height - Picture1.Height)) * 0.8
Picture1.Left = rndL: Picture1.Top = rndT
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不会,用易语言写简单
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询