Code pour afficher des nombres en format digital -- avec des barres...

Description

Ce code sert a afficher des nombres au format Digital
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| |

Source / Exemple :


Private Sub Command1_Click()
    Text1.Text = GetLCD(Text2.Text)
End Sub

Public Function GetLCD(strNombre As String) As String
    
    '*******************
    'Data pour le LCD
    
    Dim TableauLCD_Ligne1(0 To 9) As String
    
    TableauLCD_Ligne1(0) = " _ "
    TableauLCD_Ligne1(1) = "   "
    TableauLCD_Ligne1(2) = " _ "
    TableauLCD_Ligne1(3) = " _ "
    TableauLCD_Ligne1(4) = "   "
    TableauLCD_Ligne1(5) = " _ "
    TableauLCD_Ligne1(6) = " _ "
    TableauLCD_Ligne1(7) = " _ "
    TableauLCD_Ligne1(8) = " _ "
    TableauLCD_Ligne1(9) = " _ "
    
    Dim TableauLCD_Ligne2(0 To 9) As String
    
    TableauLCD_Ligne2(0) = "| |"
    TableauLCD_Ligne2(1) = "  |"
    TableauLCD_Ligne2(2) = " _|"
    TableauLCD_Ligne2(3) = " _|"
    TableauLCD_Ligne2(4) = "|_|"
    TableauLCD_Ligne2(5) = "|_ "
    TableauLCD_Ligne2(6) = "|_ "
    TableauLCD_Ligne2(7) = "  |"
    TableauLCD_Ligne2(8) = "|_|"
    TableauLCD_Ligne2(9) = "|_|"
    
    Dim TableauLCD_Ligne3(0 To 9) As String
    
    TableauLCD_Ligne3(0) = "|_|"
    TableauLCD_Ligne3(1) = "  |"
    TableauLCD_Ligne3(2) = "|_ "
    TableauLCD_Ligne3(3) = " _|"
    TableauLCD_Ligne3(4) = "  |"
    TableauLCD_Ligne3(5) = " _|"
    TableauLCD_Ligne3(6) = "|_|"
    TableauLCD_Ligne3(7) = "  |"
    TableauLCD_Ligne3(8) = "|_|"
    TableauLCD_Ligne3(9) = "  |"
    
    '**************
    
    Dim Tmp As Integer
    
    Dim strLCDLigne1 As String
    Dim strLCDLigne2 As String
    Dim strLCDLigne3 As String
    
    For x = 1 To Len(strNombre)
        Tmp = Val(Mid(strNombre, x, 1))
        
        strLCDLigne1 = strLCDLigne1 & TableauLCD_Ligne1(Tmp)
        strLCDLigne2 = strLCDLigne2 & TableauLCD_Ligne2(Tmp)
        strLCDLigne3 = strLCDLigne3 & TableauLCD_Ligne3(Tmp)
    Next x
    
    
    GetLCD = strLCDLigne1 & vbCrLf & strLCDLigne2 & vbCrLf & strLCDLigne3
    
    
End Function

Codes Sources

A voir également

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.