cs_shivan
Messages postés363Date d'inscriptionjeudi 20 décembre 2001StatutMembreDernière intervention25 août 2003
-
8 mai 2002 à 09:59
cs_FAS
Messages postés88Date d'inscriptionvendredi 26 avril 2002StatutMembreDernière intervention24 février 2006
-
3 déc. 2002 à 12:30
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
cs_FAS
Messages postés88Date d'inscriptionvendredi 26 avril 2002StatutMembreDernière intervention24 février 2006 3 déc. 2002 à 12:30
Pas mal pour un début... Mais pour ceux qui veulent plus simple, il existe deux polices qui font la même chose (LCD et Quartz). Mais bravo pour l'effort!
alex306
Messages postés4Date d'inscriptionsamedi 13 avril 2002StatutMembreDernière intervention28 mai 2002 9 mai 2002 à 20:35
Merci pour les petits conseils d'optimisation. Je suis débutant alors ca m'aide beaucoup.
@+
cs_clafouti
Messages postés78Date d'inscriptionsamedi 16 mars 2002StatutMembreDernière intervention 7 septembre 2006 9 mai 2002 à 16:50
Il y a encore moyen d'optimiser un peu plus :
Private Sub cmdGo_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Dim chiffre As Integer 'contient un chiffre seulement
If Text1.Text "" Then Text1.Text "0" 'si le texte = rien, on met 0 par defaut
For x = 1 To len(text1.text)
pic0(x-1).Picture = LoadPicture(App.Path + "" & mid(Text1.Text,x,1) & ".bmp")
Next x
End Sub
damien174
Messages postés78Date d'inscriptionjeudi 4 janvier 2001StatutMembreDernière intervention 2 mars 2012 9 mai 2002 à 11:15
salut, pas trop mal ton lcd, mais pas tres optimiser, c'est pas grave le code n'est pas complexe. je te redonne ton code avec un peu plus d'optimisation.
Option Explicit
Private Sub cmdGo_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Dim nbChiffres As Integer
Dim chiffre As Integer 'contient un chiffre seulement
If Text1.Text "" Then Text1.Text "0" 'si le texte = rien, on met 0 par defaut
nbChiffres = Len(Text1.Text) 'contient le nombre de chiffres écrit
For x = 0 To nbChiffres - 1
If nbChiffres - (x + 1) < 0 Then Exit Sub 's'il n'y a plus de chiffres, on sort
Text1.SelStart = nbChiffres - (x + 1) 'selectionne le
Text1.SetFocus 'dernier chiffre, ensuite le
Text1.SelLength = 1 'suivant....jusqu'au premier
pic0(x).Picture = LoadPicture(App.Path + "" & Text1.SelText & ".bmp")
Next x
Text1.SelStart = 0 'place le curseur au début du texte
Text1.SetFocus 'met le focus
End Sub
Private Sub Text1_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Text1.Text = "" 'efface le texte lorsqu'on click
'efface toutes les images pour recommencer a nouveau
For x = 0 To 5
Set pic0(x).Picture = Nothing
Next
End Sub
Private Sub text1_KeyPress(KeyAscii As Integer)
'pour empecher que l'usager entre autre chose que des chiffres
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0 ' Cancel le caractere.
Beep ' Son d'erreur.
End If
End Sub
A+
cs_shivan
Messages postés363Date d'inscriptionjeudi 20 décembre 2001StatutMembreDernière intervention25 août 2003 8 mai 2002 à 09:59
heu... un peu space, ton lcd mais bon, ya un effort...
8/10 !
3 déc. 2002 à 12:30
9 mai 2002 à 20:35
@+
9 mai 2002 à 16:50
Private Sub cmdGo_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Dim chiffre As Integer 'contient un chiffre seulement
If Text1.Text "" Then Text1.Text "0" 'si le texte = rien, on met 0 par defaut
For x = 1 To len(text1.text)
pic0(x-1).Picture = LoadPicture(App.Path + "" & mid(Text1.Text,x,1) & ".bmp")
Next x
End Sub
9 mai 2002 à 11:15
Option Explicit
Private Sub cmdGo_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Dim nbChiffres As Integer
Dim chiffre As Integer 'contient un chiffre seulement
If Text1.Text "" Then Text1.Text "0" 'si le texte = rien, on met 0 par defaut
nbChiffres = Len(Text1.Text) 'contient le nombre de chiffres écrit
For x = 0 To nbChiffres - 1
If nbChiffres - (x + 1) < 0 Then Exit Sub 's'il n'y a plus de chiffres, on sort
Text1.SelStart = nbChiffres - (x + 1) 'selectionne le
Text1.SetFocus 'dernier chiffre, ensuite le
Text1.SelLength = 1 'suivant....jusqu'au premier
pic0(x).Picture = LoadPicture(App.Path + "" & Text1.SelText & ".bmp")
Next x
Text1.SelStart = 0 'place le curseur au début du texte
Text1.SetFocus 'met le focus
End Sub
Private Sub Text1_Click()
Dim x As Integer 'contient l'index de l'image(pic0)
Text1.Text = "" 'efface le texte lorsqu'on click
'efface toutes les images pour recommencer a nouveau
For x = 0 To 5
Set pic0(x).Picture = Nothing
Next
End Sub
Private Sub text1_KeyPress(KeyAscii As Integer)
'pour empecher que l'usager entre autre chose que des chiffres
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0 ' Cancel le caractere.
Beep ' Son d'erreur.
End If
End Sub
A+
8 mai 2002 à 09:59
8/10 !
A+
shivan