All pastes #753696 Raw Edit

Stop Lights

public text v1 · immutable
#753696 ·published 2007-10-29 13:31 UTC
rendered paste body
Dim LightCounter As Integer
Dim FlashCounter As Integer
Dim FlashCounter2 As Integer

Private Sub RedLight1()
tmrYellowFlash.Enabled = False
shpRedLight1.BackStyle = 1
shpYellowLight1.BackStyle = 0
shpGreenLight1.BackStyle = 0
lblDont1.Visible = True
lblWalk1.ForeColor = RGB(255, 0, 0)
lblWalk1.Visible = True
End Sub

Private Sub YellowLight1()
tmrYellowFlash.Enabled = True
shpRedLight1.BackStyle = 0
shpYellowLight1.BackStyle = 1
shpGreenLight1.BackStyle = 0
lblDont1.Visible = True
lblWalk1.ForeColor = RGB(255, 0, 0)
lblWalk1.Visible = True
End Sub

Private Sub GreenLight1()
tmrYellowFlash.Enabled = False
shpRedLight1.BackStyle = 0
shpYellowLight1.BackStyle = 0
shpGreenLight1.BackStyle = 1
lblDont1.Visible = False
lblWalk1.ForeColor = RGB(0, 255, 0)
lblWalk1.Visible = True
End Sub

Private Sub RedLight2()
tmrYellowFlash2.Enabled = False
shpRedLight2.BackStyle = 1
shpYellowLight2.BackStyle = 0
shpGreenLight2.BackStyle = 0
lblDont2.Visible = True
lblWalk2.ForeColor = RGB(255, 0, 0)
lblWalk2.Visible = True
End Sub

Private Sub YellowLight2()
tmrYellowFlash2.Enabled = True
shpRedLight2.BackStyle = 0
shpYellowLight2.BackStyle = 1
shpGreenLight2.BackStyle = 0
lblDont2.Visible = True
lblWalk2.ForeColor = RGB(255, 0, 0)
lblWalk2.Visible = True
End Sub

Private Sub GreenLight2()
tmrYellowFlash2.Enabled = False
shpRedLight2.BackStyle = 0
shpYellowLight2.BackStyle = 0
shpGreenLight2.BackStyle = 1
lblDont2.Visible = False
lblWalk2.ForeColor = RGB(0, 255, 0)
lblWalk2.Visible = True
End Sub

Private Sub cmdQuit_Click()
End
End Sub

Private Sub tmrChange_Timer()
LightCounter = LightCounter + 1
If LightCounter = 1 Then
GreenLight1
RedLight2
ElseIf LightCounter = 2 Then
YellowLight1
RedLight2
ElseIf LightCounter = 3 Then
RedLight1
GreenLight2
ElseIf LightCounter = 4 Then
RedLight1
YellowLight2
LightCounter = 0
End If
End Sub

Private Sub tmrYellowFlash1_Timer()
FlashCounter = FlashCounter + 1
If FlashCounter = 1 Then
lblDont1.Visible = False
lblWalk1.Visible = False
ElseIf FlashCounter = 2 Then
lblDont1.Visible = True
lblWalk1.Visible = True
FlashCounter = 0
End If

End Sub

Private Sub tmrYellowFlash2_Timer()
FlashCounter2 = FlashCounter2 + 1
If FlashCounter2 = 1 Then
lblDont2.Visible = False
lblWalk2.Visible = False
ElseIf FlashCounter2 = 2 Then
lblDont2.Visible = True
lblWalk2.Visible = True
FlashCounter2 = 0
End If

End Sub