lunes, 12 de noviembre de 2007

SEMAFORO



CODIGO_______________________________________________________________
Private Sub Form_Load()
'no permite ver los faroles del semaforo
Shape1.Visible = False
Shape2.Visible = False
Shape3.Visible = False
End Sub

Private Sub Timer1_Timer()
'cada vez que el valor del caption del formulario se cumpliran las siguientes condiciones
Form1.Caption = Val(Form1.Caption) + 1
If Form1.Caption > 0 Then
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
If Form1.Caption > 5 Then
Shape1.Visible = False
Shape2.Visible = True
Shape3.Visible = False
If Form1.Caption > 10 Then
Shape1.Visible = False
Shape2.Visible = False
Shape3.Visible = True
If Form1.Caption > 15 Then
Shape1.Visible = False
Shape2.Visible = True
Shape3.Visible = False
If Form1.Caption > 20 Then
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
Form1.Caption = "0"
End If
End If
End If
End If
End If
End Sub