关于exit sub,请指教
有一个红绿灯程序,红灯从5开始倒计时,绿灯从10开始倒计时,黄灯从2开始倒计时,依次顺序为红灯-绿灯-黄灯-红灯程序加载时显示为红灯。想请教:在timer1_timer()中,如果不加exit sub,倒计时绿灯为什么从9开始,黄灯为什么从1开始
程序如下:
Dim x%
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Call Option1_Click
End Sub
Private Sub Option1_Click()
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
x = 5
Label1.Caption = x
Label1.ForeColor = vbRed
End Sub
Private Sub Option2_Click()
Shape1.Visible = False
Shape2.Visible = True
Shape3.Visible = False
x = 2
Label1.Caption = x
Label1.ForeColor = vbYellow
End Sub
Private Sub Option3_Click()
Shape1.Visible = False
Shape2.Visible = False
Shape3.Visible = True
x = 10
Label1.Caption = x
Label1.ForeColor = vbGreen
End Sub
Private Sub Timer1_Timer()
If Option1.Value Then
x = x - 1
If x < 0 Then Option3.Value = True: Exit Sub
End If
If Option3.Value Then
x = x - 1
If x < 0 Then Option2.Value = True: Exit Sub
End If
If Option2.Value Then
x = x - 1
If x < 0 Then Option1.Value = True: Exit Sub
End If
Label1.Caption = x
End Sub