VB滚动的小球 编程实现小球沿窗体内侧边框的连续顺时针滑动.
Dim x As Long, y As Long, d As Long
Private Sub Form_Load()
Shape1.Shape = 3
Timer1.Interval = 50
x = 0
y = -1
d = 100
End Sub
Private Sub Timer1_Timer()
Dim r As Long, b As Long
r = Form1.ScaleWidth - Shape1.Width
b = Form1.ScaleHeight - Shape1.Height
If y <= 0 Then
y = 0
x = x + d
End If
If x >= r Then
x = r
y = y + d
End If
If y >= b Then
y = b
x = x - d
End If
If x <= 0 Then
x = 0
y = y - d
End If
Shape1.Top = y
Shape1.Left = x
End Sub