本文使用「署名 4.0 国际 (CC BY 4.0)」许可协议,欢迎转载、或重新修改使用,但需要注明来源。 [署名 4.0 国际 (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.zh) 本文作者: 苏洋 创建时间: 2009年01月09日 统计字数: 497字 阅读时间: 1分钟阅读 本文链接: https://soulteary.com/2009/01/09/how-to-make-bound.html ----- # [vb]如何制作弹性小球 ```vb Option Explicit Dim MoveX, MoveY As Integer Private Sub Form_Load() With Me .Height = 6810 .Width = 7365 End With With shpRect .Top = 120 .Left = 120 .Width = 6975 .Height = 6135 End With With shpCircle .Top = 120 .Left = 120 .Height = 615 .Width = 735 End With MoveX = 1: MoveY = 1 End Sub Private Sub Timer1_Timer() With shpCircle .Left = .Left + (MoveX * 80) .Top = .Top + (MoveY * 80) Select Case .Left Case Is <= 120: MoveX = MoveX * -1 Case Is >= 6360: MoveX = MoveX * -1 End Select Select Case .Top Case Is <= 120: MoveY = MoveY * -1 Case Is >= 5640: MoveY = MoveY * -1 End Select End With End Sub ```