Bonjour à tous,
...mais un défaut de fluidité intervient quand le curseur se déplace trop vite entre 2 TextBox.
Ne sachant pas si c'est quelque chose de modifiable avec ta méthode, je suis parti d'une feuille blanche.
Je n'ai pas compris le choix de l'utilisation de TextBox, je les ai remplacés par 2 Labels par ligne (2 Labels pour mieux centrer le texte) :
Je voudrais par la suite quand je clique sur une des Textbox, que la couleur de celle ci reste fixe, pendant que les autres continueront de "clignoter" en fonction du passage de la souris jusqu’à un nouveau clic sur une autre TextBox.
C'est ajouté également.
Le fichier :
Le code :
'https://forum.excel-pratique.com/viewtopic.php?f=2&t=132543
Dim numeroClic
'SURVOL
Private Sub overColor(numero)
resetColors
ActiveSheet.OLEObjects("Label" & numero).Object.BackColor = &H1A31D5
End Sub
Private Sub resetColors()
For i = 1 To 5
ActiveSheet.OLEObjects("Label" & i).Object.BackColor = IIf(numeroClic = i, &H1A31D5, &H3E352A)
Next
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 1
End Sub
Private Sub Label2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 2
End Sub
Private Sub Label3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 3
End Sub
Private Sub Label4_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 4
End Sub
Private Sub Label5_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 5
End Sub
Private Sub Label1b_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 1
End Sub
Private Sub Label2b_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 2
End Sub
Private Sub Label3b_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 3
End Sub
Private Sub Label4b_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 4
End Sub
Private Sub Label5b_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
overColor 5
End Sub
'CLIC
Private Sub Label1b_Click()
numeroClic = 1
End Sub
Private Sub Label2b_Click()
numeroClic = 2
End Sub
Private Sub Label3b_Click()
numeroClic = 3
End Sub
Private Sub Label4b_Click()
numeroClic = 4
End Sub
Private Sub Label5b_Click()
numeroClic = 5
End Sub
Private Sub Label1_Click()
Label1b_Click
End Sub
Private Sub Label2_Click()
Label2b_Click
End Sub
Private Sub Label3_Click()
Label3b_Click
End Sub
Private Sub Label4_Click()
Label4b_Click
End Sub
Private Sub Label5_Click()
Label5b_Click
End Sub