VB交通灯的程序!!

来源:百度知道 编辑:UC知道 时间:2024/05/29 11:32:12
大家好..我是个初学VB的学生....大家能不能教我下怎么样用shape来做交通灯系统?红5 黄 3 绿 5 顺序是 红黄绿 绿黄红 显示的倒计时是用数码管或label来做...谢谢!

Option Explicit
Dim I As Byte, Tim As Byte, Tim1 As Byte
Private Sub Form_Load()
Form1.AutoRedraw = True
For I = 0 To 2
Shape1(I).Width = 1000
Shape1(I).Height = 1000
Shape1(I).Top = 100
Shape1(I).Left = 100 + I * 1000
Shape1(I).FillStyle = 0
Shape1(I).Shape = 3
Shape1(I).BorderWidth = 10
Next
Shape1(0).FillColor = vbBlack
Shape1(1).FillColor = vbBlack
Shape1(2).FillColor = vbBlack
Label1.Caption = ""
Label1.Alignment = 1
Label1.Width = 3000
Label1.Height = 1000
Label1.Top = 1200
Label1.Left = 100
Label1.BackColor = &H0
Label1.ForeColor = vbRed
Label1.FontSize = 50
Tim = 0
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Tim = Tim + 1
Tim = Tim Mod 26
Select Case Tim