Cette source n'a pas la fierté de présenter une barre de chargement réelle, elle est plutôt un exemple, et un exercice, qui permet de faire connaissance avec les timers.
Voici les composants à mettre sur votre form :
1 timer (interval = 100 - name=timer1)
1 zone de texte (text= « 1 » - name = txttime)
Autant d'image qu'il vous faut pour compléter votre barre (des images de rectangle par exemple) (name=image1, image2, image3.. - visible = false)
(Code à mettre sur le chargement du formulaire)
Source / Exemple :
Dim i As Integer
Private Sub Timer1_Timer()
If txttime.Text = 1 Then
Image2.Visible = True
End If
If txttime.Text = 3 Then
Image3.Visible = True
End If
If txttime.Text = 5 Then
Image4.Visible = True
End If
If txttime.Text = 7 Then
Image5.Visible = True
End If
If txttime.Text = 9 Then
Image6.Visible = True
End If
If txttime.Text = 11 Then
Image7.Visible = True
End If
If txttime.Text = 13 Then
Image8.Visible = True
End If
If txttime.Text = 15 Then
Image9.Visible = True
End If
If txttime.Text = 17 Then
Image10.Visible = True
End If
If txttime.Text = 19 Then
Image11.Visible = True
End If
If txttime.Text = 21 Then
Image12.Visible = True
End If
If txttime.Text = 23 Then
Image13.Visible = True
End If
If txttime.Text = 25 Then
Image14.Visible = True
End If
If txttime.Text = 27 Then
Image15.Visible = True
End If
If txttime.Text = 29 Then
Image16.Visible = True
End If
If txttime.Text = 31 Then
Image17.Visible = True
End If
If txttime.Text = 33 Then
Image18.Visible = True
End If
If txttime.Text = 35 Then
Image19.Visible = True
End If
If txttime.Text = 36 Then
Unload Me
Else
txttime.Text = txttime.Text + 1
End If
Conclusion :
C juste un petit exo hein ;-)
Biz
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.