¿Cómo programar un reloj electrónico usando VB? ¡Trae también un cronómetro!
El primer paso, abrir vb
El segundo paso, agregar un temporizador, una etiqueta de texto
El tercer paso, ingresar el código, el código es de la siguiente manera
Private Sub Form_Load()
picClock.Move (Me.ScaleWidth - 8 * 210) / 2, (Me.ScaleHeight - 315) / 2, 8 * 210, 315
Dim iamp;
Para i = 0 a 7
picClock.PaintPicture picNumber.Picture, i * 210, 0, 210, 315, IIf( (i = 2) O (i = 5), 12, 10) * 210, 0, 210, 315
Siguiente i
Fin Sub
Privado Sub Timer1_Timer ()
Dim cNow$, iamp;
cNow = Format(Now, "hh:mm:ss")
For i = 0 A 7
Si Mid(cNow, i 1, 1) lt;gt ":" Entonces
picClock.PaintPicture picNumber.Picture, i * 210, 0, 210, 315, Val( Mid(cNow, i 1, 1)) * 210, 0, 210, 315
End If
Siguiente i
End Sub
Espero adoptarlo
El código anterior es incorrecto, el siguiente es el código correcto
Private Sub Form_Load()
Timer1.Enabled = Verdadero
Timer1.Interval = 300
End Sub
Private Sub Timer1_Timer()
Label1 = Ahora
Fin Sub