1个回答
展开全部
Rem 让小球遇到边框弹回来
Dim deltX As Integer
Private Sub Form_Load()
Timer1.Interval = 10
deltX = Rnd * 100
End Sub
Private Sub Timer1_Timer()
Shape1.Left = Shape1.Left + deltX
Shape1.Top = Shape1.Top + deltX
If Shape1.Left < 0 Then deltX = -deltX
If Shape1.Left + Shape1.Width > Me.Width Then deltX = -deltX
If Shape1.Top + Shape1.Height > Me.Height Then deltX = -deltX
If Shape1.Top < 0 Then deltX = -deltX
End Sub
Dim deltX As Integer
Private Sub Form_Load()
Timer1.Interval = 10
deltX = Rnd * 100
End Sub
Private Sub Timer1_Timer()
Shape1.Left = Shape1.Left + deltX
Shape1.Top = Shape1.Top + deltX
If Shape1.Left < 0 Then deltX = -deltX
If Shape1.Left + Shape1.Width > Me.Width Then deltX = -deltX
If Shape1.Top + Shape1.Height > Me.Height Then deltX = -deltX
If Shape1.Top < 0 Then deltX = -deltX
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询