Étape 2: Code !
Double-cliquez sur la barre de suivi. 2 lignes de code devraient apparaître. Quelque chose comme :
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll End Sub
Maintenant, nous apprenons sur les valeurs. Sur cette trackbar, nous pouvons seulement obtenir 11 valeurs, 0-10. Valeur 0 est l’extrême gauche, tandis que la valeur 10 est la très bonne. Vous avez qui ? Permet de déplacer.
Pour faciliter la vie tout le texte dans cette étape à l’avenir va être code-style
In between the two lines of code type in:If TrackBar1.Value = placceavaluenumberhere ThenEnd Ifreplacing placeavaluenumberhere with the value number of the place where you want it to be. Now in between those 4 lines of code type what you want to do. In this case:TextBox1.BackColor = Color.BlackOnce you're done that repeat for each place. When I was done it looked like this:Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll If TrackBar1.Value = 0 Then TextBox1.BackColor = Color.Black End If If TrackBar1.Value = 1 Then TextBox1.BackColor = Color.White End If If TrackBar1.Value = 2 Then TextBox1.BackColor = Color.Red End If If TrackBar1.Value = 3 Then TextBox1.BackColor = Color.Blue End If If TrackBar1.Value = 4 Then TextBox1.BackColor = Color.Yellow End If If TrackBar1.Value = 5 Then TextBox1.BackColor = Color.Purple End If If TrackBar1.Value = 6 Then TextBox1.BackColor = Color.Green End If If TrackBar1.Value = 7 Then TextBox1.BackColor = Color.Orange End If If TrackBar1.Value = 8 Then TextBox1.BackColor = Color.Brown End If If TrackBar1.Value = 9 Then TextBox1.BackColor = Color.White End If If TrackBar1.Value = 10 Then TextBox1.BackColor = Color.White End If End Sub