TEMA 21: Programa Las Vegas
9. Programa: en este programa se utiliza un método nuevo llamado Move, utilizado para mover los controles y una función nueva llamada QBColor para mostrar un color.
| OBJETO | PROPIEDAD | VALOR |
| Form1 | BorderStyle Caption Icon |
1 Las Vegas Misc36.ico (Graphics, Icons, Misc) |
| LblLuz (0..17) | BorderStyle Caption |
1 - |
| CmdVegas | Caption Font |
Las Vegas Comic Sans MS, negrita, 14 |
| TmrLuz, TmrVegas | Enabled Interval |
False 200, 500 |
Dim A, Color As Integer
Bajate el programa completo haciendo clic en la imagen
Private Sub CmdVegas_Click()
TmrLuz.Enabled = True: TmrVegas.Enabled = True 'Activa luces y movimiento
For A = 0 To 17
LblLuz(A).BackColor = QBColor(Color) 'Establece el color a las luces
Color = Color + 1
If Color = 16 Then Color = 0
Next A
End Sub
Private Sub TmrLuz_Timer()
CmdVegas_Click 'Repetición del procedimiento CmdVegas
End Sub
Private Sub TmrVegas_Timer()
Static Opcion As Integer
Form1.BackColor = QBColor(Color) 'Color de fondo
'El botón se mueve hacia arriba
If Opcion = 0 Then
CmdVegas.Move CmdVegas.Left, CmdVegas.Top - 400, CmdVegas.Width, _
CmdVegas.Height
If CmdVegas.Top = 800 Then Opcion = 1: Exit Sub
End If
'El botón se mueve hacia la izquierda
If Opcion = 1 Then
CmdVegas.Move CmdVegas.Left - 400, CmdVegas.Top, CmdVegas.Width, _
CmdVegas.Height
If CmdVegas.Left = 800 Then Opcion = 2: Exit Sub
End If
'El botón se mueve hacia abajo
If Opcion = 2 Then
CmdVegas.Move CmdVegas.Left, CmdVegas.Top + 400, CmdVegas.Width, _
CmdVegas.Height
If CmdVegas.Top = 4800 Then Opcion = 3: Exit Sub
End If
'El botón se mueve hacia la derecha
If Opcion = 3 Then
CmdVegas.Move CmdVegas.Left + 400, CmdVegas.Top, CmdVegas.Width, _
CmdVegas.Height
If CmdVegas.Left = 4400 Then Opcion = 0: Exit Sub
End If
End Sub
![]()