如题,类似于漂浮广告那种,
轨迹有规律,随机的都可以,
要求不会漂出边界,并且碰到边界后弹回来的轨迹是连续的。
谢谢各位了!
[此贴子已经被作者于2006-12-9 14:12:59编辑过]
Private Sub Form_Load()
motion = 1
End Sub
Private Sub Timer1_Timer()
Select Case motion
Case 1
Shape1.Move Shape1.Left - 20, Shape1.Top - 20
If Shape1.Left <= 0 Then
motion = 2
ElseIf Shape1.Top <= 0 Then
motion = 4
End If
Case 2
Shape1.Move Shape1.Left + 20, Shape1.Top - 20
If Shape1.Left >= Me.Width - Shape1.Width Then
motion = 1
ElseIf Shape1.Top <= 0 Then
motion = 3
End If
Case 3
Shape1.Move Shape1.Left + 20, Shape1.Top + 20
If Shape1.Left >= Me.Width - Shape1.Width Then
motion = 4
ElseIf Shape1.Top >= Me.Height - Shape1.Height - 680 Then
motion = 2
End If
Case 4
Shape1.Move Shape1.Left - 20, Shape1.Top + 20
If Shape1.Left <= 0 Then
motion = 3
ElseIf Shape1.Top >= Me.Height - Shape1.Height - 680 Then
motion = 1
End If
End Select
End Sub