Tema: Semáforo
Ver Mensaje Individual
  #15 (permalink)  
Antiguo 26/06/2006, 13:07
topskil
 
Fecha de Ingreso: junio-2006
Mensajes: 1
Antigüedad: 18 años, 10 meses
Puntos: 0
Bueno esta seria una opcion sin tocar el visible, o sea, no se dejan de ver nunca

HE utilizado el QBCOLOR porque no tenia ganas de buscar el amarillo en RGB ;)
Código:
Dim col As Integer                                 ' Definimos la variable
Private Sub Command1_Click()
If col = 1 Then
    Shape1.BackColor = RGB(255, 0, 0)       ' Ponemos el SHAPE1 en rojo
    Shape3.BackColor = RGB(0, 0, 0)          ' Ponemos el SHAPE3 en negro
    col = 2                                             ' Ponemos la variable a 2
        Exit Sub
End If
If col = 2 Then
    Shape2.BackColor = QBColor(14)          'Ponemos el SHAPE2 en amarillo
    Shape1.BackColor = RGB(0, 0, 0)          'Ponemos el SHAPE1 en negro
    col = 3                                            'Ponemos la variable a 3
        Exit Sub
End If
If col = 3 Then
    Shape3.BackColor = RGB(0, 255, 0)       'Ponemos el SHAPE3 en rojo
    Shape2.BackColor = RGB(0, 0, 0)          'Ponemos le SHAPE2 en negro
    col = 1                                            'Ponemos la variable a 1 para que vuelva a empezart
    Refresh
        Exit Sub
End If

End Sub

Private Sub Form_Load()
Command1.caption = "Cambiar luz"   'Da el nombre al boton
Form1.caption = "Topskil ;)"            'DA el nombre al formulario
'Pone los shapes negros --------------------------------
Shape1.BackColor = RGB(0, 0, 0)
Shape2.BackColor = RGB(0, 0, 0)
Shape3.BackColor = RGB(0, 0, 0)
'-------------------------------------------------------
col = 1
End Sub

Última edición por topskil; 26/06/2006 a las 13:15