|
学习交流,老鸟勿喷。如有疏漏,多多指教。
Dim stepx%, rr%, lr$, xx1%, yy1% Private Sub Form_Load()
stepx = 50: rr = 100
Me.FillStyle = 0
Me.FillColor = QBColor(12)
Me.AutoRedraw = True
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Line1.x1 = 100: Line1.y1 = 100: Line1.X2 = 100: Line1.Y2 = 1000
Line2.x1 = Me.Width - 200: Line2.y1 = 100: Line2.X2 = Me.Width - 200: Line2.Y2 = 1000
xx1 = Line1.x1 + rr
yy1 = (Line1.Y2 - Line1.y1) \ 2
Timer1.Interval = 50
lr = "R"
End SubPrivate Sub Timer1_Timer()
xx1 = IIf(lr = "R", xx1 + stepx, xx1 - stepx)
lr = IIf(xx1 >= Line2.x1 - rr, "L", lr)
lr = IIf(xx1 <= Line1.x1 + rr, "R", lr)
Me.Cls
Me.CurrentX = xx1: Me.CurrentY = yy1
Me.Circle (xx1, yy1), rr
End Sub
|
|