1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Option Compare Database
Public bytCompteur As Byte
Private Sub Form_Open(Cancel As Integer)
'met l'interval à 1s
Me.TimerInterval = 1000
'initialisation du compteur
bytCompteur = 0
End Sub
Private Sub Form_Timer()
'test valeur si compteur = 5
If Not bytCompteur = 5 Then
'test si le fond du control = Blanc
If Me.MonChamp.BackColor = RGB(255, 255, 255) Then
'si blanc on met le fond en noir et l'écriture en blanc + on ajoute 1 au compteur
Me.MonChamp.BackColor = RGB(0, 0, 0)
Me.MonChamp.ForeColor = RGB(255, 255, 255)
bytCompteur = bytCompteur + 1
Else
'si non blanc on met le fond en blanc et l'écriture en noir + on ajoute 1 au compteur
Me.MonChamp.BackColor = RGB(255, 255, 255)
Me.MonChamp.ForeColor = RGB(0, 0, 0)
bytCompteur = bytCompteur + 1
End If
Else
'dès que l'on arrive à 5 on remt tout à l'origine
Me.MonChamp.BackColor = RGB(255, 255, 255)
Me.MonChamp.ForeColor = RGB(0, 0, 0)
Me.TimerInterval = 0
bytCompteur = 0
End If
End Sub |
Partager