- 首页
-
- 问答
-
-
灰太狼
大家都太积极了,我也贴出来好了,新建一个窗体只需要添加下面的代码就可以运行注:这是CBM666的代码,我不是原创,但是我很欣赏CBM666,简直是崇拜啊。。。。Option ExplicitPrivate WithEvents Timer1 As TimerDim i%, j%, x1%, y1%, blockw%, blockh%, carX%, carY%, pcolor$Dim N%, L%, C$Const Captions As String = "烟花飘飘的小汽车"Private Sub Form_Load() Me.AutoRedraw = True Me.DrawWidth = 2 Me.Width = 5120 Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2 Me.Cls carY = Me.Height \ 2: blockw = 500: blockh = 200 x1 = 0: y1 = carY - 230 Set Timer1 = Controls.Add("vb.timer", "timer1") Timer1.Interval = 50End SubPrivate Sub Timer1_Timer() Me.Cls For i = 1 To 12 pcolor = IIf(i Mod 2 = 0, vbBlue, vbRed) Line (carX - j, carY)-(carX - j + blockw, carY + blockh), pcolor, BF carX = IIf(carX + 500 >= 6000, 0, carX + 500) Next i j = IIf(j + 100 > 900, 0, j + 100) Line (x1, y1)-(x1 + 500, y1 + 100), , B Me.Circle (x1 + 100, y1 + 150), 50 Me.Circle (x1 + 380, y1 + 150), 50 x1 = IIf(x1 + 50 >= 5000, -500, x1 + 50) L = Int(Me.Width / 220) C = String(L, " ") & Captions & String(L, " ") N = N + 1 If N > Len(C) - L Then N = 1 Me.Caption = Mid(C, N, L)End Sub
-
-
-
-
-
-
-
-
求购