Chronomètre

Soyez le premier à donner votre avis sur cette source.

Vue 6 287 fois - Téléchargée 733 fois

Description

Comme tout bon chronomètre, il calcul le temps écoulé, mais aussi, il permet de calculer le temps de chaque tours. De plus, il insère ces temps dans un listbox que l'on peut visualiser.

Source / Exemple :


' À mettre dans une form1

Private Sub Form_Load()
LblSeconde.Caption = "00"
LblMinute.Caption = "00"
LblHeure.Caption = "00"
LblDixieme.Caption = "00"

LblSecondeL.Caption = "00"
LblMinuteL.Caption = "00"
LblHeureL.Caption = "00"
LblDixiemeL.Caption = "00"

Lap.LstLaps.Clear

End Sub

Private Sub LblDixieme_Change()
If LblDixieme = 100 Then
LblDixieme.Caption = "00"

If (LblSeconde = "00") Or (LblSeconde = "01") Or (LblSeconde = "02") Or (LblSeconde = "03") _
Or (LblSeconde = "04") Or (LblSeconde = "05") Or (LblSeconde = "06") Or (LblSeconde = "07") _
Or (LblSeconde = "08") Then
LblSeconde = "0" & LblSeconde + 1
Else
LblSeconde = LblSeconde + 1
End If

End If
End Sub

Private Sub LblDixiemeL_Change()
If LblDixiemeL = 100 Then
LblDixiemeL.Caption = "00"

If (LblSecondeL = "00") Or (LblSecondeL = "01") Or (LblSecondeL = "02") Or (LblSecondeL = "03") _
Or (LblSecondeL = "04") Or (LblSecondeL = "05") Or (LblSecondeL = "06") Or (LblSecondeL = "07") _
Or (LblSecondeL = "08") Then
LblSecondeL = "0" & LblSecondeL + 1
Else
LblSecondeL = LblSecondeL + 1
End If

End If

End Sub

Private Sub LblMinuteL_Change()
If LblMinuteL = 60 Then
LblMinuteL.Caption = "00"

If (LblHeureL = "00") Or (LblHeureL = "01") Or (LblHeureL = "02") Or (LblHeureL = "03") _
Or (LblHeureL = "04") Or (LblHeureL = "05") Or (LblHeureL = "06") Or (LblHeureL = "07") _
Or (LblHeureL = "08") Then
LblHeureL = "0" & LblHeureL + 1
Else
LblHeureL = LblHeureL + 1
End If

End If

End Sub

Private Sub LblSeconde_Change()
If LblSeconde = 60 Then
LblSeconde.Caption = "00"

If (LblMinute = "00") Or (LblMinute = "01") Or (LblMinute = "02") Or (LblMinute = "03") _
Or (LblMinute = "04") Or (LblMinute = "05") Or (LblMinute = "06") Or (LblMinute = "07") _
Or (LblMinute = "08") Then
LblMinute = "0" & LblMinute + 1
Else
LblMinute = LblMinute + 1
End If

End If

End Sub

Private Sub LblMinute_Change()
If LblMinute = 60 Then
LblMinute.Caption = "00"

If (LblHeure = "00") Or (LblHeure = "01") Or (LblHeure = "02") Or (LblHeure = "03") _
Or (LblHeure = "04") Or (LblHeure = "05") Or (LblHeure = "06") Or (LblHeure = "07") _
Or (LblHeure = "08") Then
LblHeure = "0" & LblHeure + 1
Else
LblHeure = LblHeure + 1
End If

End If

End Sub

Private Sub LblSecondeL_Change()
If LblSecondeL = 60 Then
LblSecondeL.Caption = "00"

If (LblMinuteL = "00") Or (LblMinuteL = "01") Or (LblMinuteL = "02") Or (LblMinuteL = "03") _
Or (LblMinuteL = "04") Or (LblMinuteL = "05") Or (LblMinuteL = "06") Or (LblMinuteL = "07") _
Or (LblMinuteL = "08") Then
LblMinuteL = "0" & LblMinuteL + 1
Else
LblMinuteL = LblMinuteL + 1
End If

End If

End Sub

Private Sub Quit_Click()
End
End Sub

Private Sub Reset_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Reset.Enabled = False
Call Form_Load
End Sub

Private Sub SeeLaps_Click()
Form1.Enabled = False
Lap.Show
End Sub

Private Sub Start_Click()
Timer1.Enabled = True
Timer2.Enabled = True
Start.Enabled = False
Arret.Enabled = True
Reset.Enabled = False

LblHeure = "00"
LblMinute = "00"
LblSeconde = "00"
LblDixieme = "00"

Tours.Enabled = True

End Sub

Private Sub Timer1_Timer()

If (LblDixieme = "00") Or (LblDixieme = "01") Or (LblDixieme = "02") Or (LblDixieme = "03") _
Or (LblDixieme = "04") Or (LblDixieme = "05") Or (LblDixieme = "06") Or (LblDixieme = "07") _
Or (LblDixieme = "08") Then
LblDixieme = "0" & LblDixieme + 1
Else
LblDixieme = LblDixieme + 1
End If

End Sub

Private Sub Arret_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Arret.Enabled = False
Start.Enabled = True
Reset.Enabled = True
SeeLaps.Enabled = True

Lap.LstLaps.AddItem Lap.TxtTours.Text & "- " & LblHeure & ":" & LblMinute & ":" & LblSeconde & "." & LblDixieme
Lap.LstLaps.AddItem "Temps total = " & LblHeureL & ":" & LblMinuteL & ":" & LblSecondeL & "." & LblDixiemeL

End Sub

Private Sub Timer2_Timer()

If (LblDixiemeL = "00") Or (LblDixiemeL = "01") Or (LblDixiemeL = "02") Or (LblDixiemeL = "03") _
Or (LblDixiemeL = "04") Or (LblDixiemeL = "05") Or (LblDixiemeL = "06") Or (LblDixiemeL = "07") _
Or (LblDixiemeL = "08") Then
LblDixiemeL = "0" & LblDixiemeL + 1
Else
LblDixiemeL = LblDixiemeL + 1
End If

End Sub

Private Sub Tours_Click()
Timer1.Enabled = False
Start.Enabled = True
Tours.Enabled = False

Lap.LstLaps.AddItem Lap.TxtTours.Text & "- " & LblHeure & ":" & LblMinute & ":" & LblSeconde & "." & LblDixieme
Lap.TxtTours.Text = Lap.TxtTours.Text + 1

SeeLaps.Enabled = True

Call Start_Click:

End Sub

Codes Sources

A voir également

Ajouter un commentaire Commentaires
Messages postés
962
Date d'inscription
samedi 19 janvier 2002
Statut
Membre
Dernière intervention
2 août 2010
1
Pratik
Messages postés
36
Date d'inscription
mercredi 4 octobre 2000
Statut
Membre
Dernière intervention
29 juin 2004

Il faudrait mettre le code aussi, Parce que juste un .exe seul appart, c'a fait suspect...

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.

Du même auteur (simonboily)