VB程序实现小球的下落,单击窗体小球下落,小球接触到地面时返回顶部
展开全部
Dif f As Boolean
Private Sub Form_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If f Then
Shape1.FillColor = QBColor(Int(13*Rnd+1))
Shape1.Top = 0
f = False
Else
Shape1.Top = Shape1.Top + 100
If Shape1.Top + Shape1.Height >= Line1.Top Then f = True
End If
End Sub
Private Sub Shape1_Click()
If Timer1.Enable = False Then Exit Sub '小球没有下落时,点击Shape1不退出
Unload me
End Sub
Private Sub Form_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If f Then
Shape1.FillColor = QBColor(Int(13*Rnd+1))
Shape1.Top = 0
f = False
Else
Shape1.Top = Shape1.Top + 100
If Shape1.Top + Shape1.Height >= Line1.Top Then f = True
End If
End Sub
Private Sub Shape1_Click()
If Timer1.Enable = False Then Exit Sub '小球没有下落时,点击Shape1不退出
Unload me
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询