vb的红绿灯问题
就是用一个或几个时间控件,还有三个图片,通过设置他们的visble的值来控制红绿灯的实现.我以前以为很简单,自己做了发现,很难请大家帮帮忙
Private Sub Timer1_Timer()
Picture1.Visible = True
Picture2.Visible = False
Picture2.Visible = False
a = a + 1
Label1.Caption = a
If a = 5 Then
Timer1.Enabled = False
Timer2.Enabled = True
Timer3.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
Picture1.Visible = False
Picture2.Visible = True
Picture2.Visible = False
b = b + 1
Label1.Caption = b
If b = 3 Then
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = True
End If
End Sub
Private Sub Timer3_Timer()
Picture1.Visible = True
Picture2.Visible = False
Picture2.Visible = False
c = c + 1
Label1.Caption = c
If c = 5 Then
Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False
End If
End Sub