Function Calc! (ByVal Chaine$)
  '** Chaine$ est une expression du type:
  '   "23.25+(12*13554.2)-sin14.22/exp24"
  '** Liste des oprateurs:
  '   SIN COS TAN EXP LOG E ^ + - * /
  '** On calcule d'abord ce qui est entre ():
  Chaine$ = UCase$(Chaine$)
  Do
    in = InStr(in2 + 1, Chaine$, "(")
    If in > 0 Then
      'in2 = InStr(in + 1, Chaine$, ")")
      i = in
      nbpar = 1
      Do
        i = i + 1
        m$ = Mid$(Chaine$, i, 1)
        If m$ = "(" Then nbpar = nbpar + 1
        If m$ = ")" Then nbpar = nbpar - 1
      Loop Until nbpar = 0
      in2 = i
      nombre$ = Format$(Calc!(Mid$(Chaine$, in + 1, in2 - in - 1)), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "sin230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "SIN", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Sin(Val(nombre$)), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "cos230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "COS", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Cos(Val(nombre$)), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "tan230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "TAN", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Tan(Val(nombre$)), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "LOG230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "LOG", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Log(Abs(Val(nombre$))), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "exp230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "EXP", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Exp(Val(nombre$)), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '** On remplace les expressions du type "SQR230.1"
  '   par leur valeurs:
  in2 = 1
  Do
    in = InStr(in2, Chaine$, "SQR", 1)
    inn = in + 3
    If in > 0 Then
      in2 = Len(Chaine$)
      For ii = inn To Len(Chaine$)
        m$ = Mid$(Chaine$, ii, 1)
        If InStr("-0123456789.", m$) < 1 Then in2 = ii - 1: Exit For
      Next ii
      nombre$ = ""
      For ii = inn To in2
        nombre$ = nombre$ + Mid$(Chaine$, ii, 1)
      Next ii
      nombre$ = Format$(Sqr(Abs(Val(nombre$))), "0.00000000")
      Chaine$ = Left$(Chaine$, in - 1) + nombre$ + Right$(Chaine$, Len(Chaine$) - in2)
    End If
  Loop Until in < 1
  '
  '** On reche4rche les expressions "--" dues  la
  '   soustraction d'une expression ngative comme
  '   "1-log0.1" par exemple.
  in = 1
  Do
    MoinsMoins = 0
    Do
      in = InStr(in, Chaine$, "--")
      If in > 0 Then
        Chaine$ = Left$(Chaine$, in - 1) + "+" + Right$(Chaine$, Len(Chaine$) - in - 1)
        MoinsMoins = 1
      End If
    Loop Until in < 1
    in = 1
  Loop Until MoinsMoins = 0
  in = 1
  Do
    MoinsMoins = 0
    Do
      in = InStr(in, Chaine$, "++")
      If in > 0 Then
        Chaine$ = Left$(Chaine$, in - 1) + "+" + Right$(Chaine$, Len(Chaine$) - in - 1)
        MoinsMoins = 1
      End If
    Loop Until in < 1
    in = 1
  Loop Until MoinsMoins = 0
  '
  '** Le signe <-> faisant partie du nombre, il faut
  '   traduire les soustractions par <+->
  '   Mais il faut laisser ce qui est du type "14*-5"
  in = 1
  Do
    in = InStr(in + 2, Chaine$, "-")
    If in > 0 Then
      If InStr("1234567890.", Mid$(Chaine$, in - 1, 1)) Then
      Chaine$ = Left$(Chaine$, in - 1) + "+-" + Right$(Chaine$, Len(Chaine$) - in)
      MoinsMoins = 1
      End If
    End If
  Loop Until in < 1
  '
  ReDim CalcNb!(100), CalcOp$(100)
  dummy$ = ""
  Typ% = 0
  PTyp% = 0
  If Left$(Chaine$, 1) = "-" Then Chaine$ = "0+" + Chaine$
  inb% = 0 'Indice CalcNb%
  iop% = 0 'Indice CalcOp$
  For i = 1 To Len(Chaine$)
    m$ = Mid$(Chaine$, i, 1)
    If InStr("-0123456789.", m$) > 0 Then Typ% = 0 Else Typ% = 1
    If Typ% = PTyp% Then
      dummy$ = dummy$ + m$
    Else
      If Typ% = 0 Then
        iop% = iop% + 1
        CalcOp$(iop%) = dummy$
      Else
        inb% = inb% + 1
        CalcNb!(inb%) = Val(dummy$)
      End If
      dummy$ = m$
    End If
    PTyp% = Typ%
  Next i
  If Typ% = 1 Then
    iop% = iop% + 1
    CalcOp$(iop%) = dummy$
  Else
    inb% = inb% + 1
    CalcNb!(inb%) = Val(dummy$)
  End If
  '
  '** l'oprateur "^" a la plus forte priorit:
  If inb% > 1 Then
    For i = 2 To inb%
      If CalcOp$(i - 1) = "^" Then
        CalcNb!(i - 1) = CalcNb!(i - 1) ^ CalcNb!(i)
        CalcNb!(i) = 0
        CalcOp$(i - 1) = "+"
      End If
    Next i
  End If
  '** l'oprateur "E" a la plus forte priorit aprs ^:
  If inb% > 1 Then
    For i = 2 To inb%
      If CalcOp$(i - 1) = "E" Then
        CalcNb!(i - 1) = CalcNb!(i - 1) * (10 ^ CalcNb!(i))
        CalcNb!(i) = 0
        CalcOp$(i - 1) = "+"
      End If
    Next i
  End If
  '** les oprateurs "*" et "/" ont priorit sur "+" et "-":
  If inb% > 1 Then
    For i = 2 To inb%
      If CalcOp$(i - 1) = "*" Then
        CalcNb!(i - 1) = CalcNb!(i - 1) * CalcNb!(i)
        CalcNb!(i) = 0
        CalcOp$(i - 1) = "+"
      End If
      If CalcOp$(i - 1) = "/" Then
        CalcNb!(i - 1) = CalcNb!(i - 1) / CalcNb!(i)
        CalcNb!(i) = 0
        CalcOp$(i - 1) = "+"
      End If
    Next i
  End If
 '** On fini le calcul avec les "+" et les "-" qui restent
  Res! = CalcNb!(1)
  If inb% > 1 Then
    For i = 2 To inb%
      If CalcOp$(i - 1) = "-" Then Res! = Res! - CalcNb!(i)
      If CalcOp$(i - 1) = "+" Then Res! = Res! + CalcNb!(i)
    Next i
  End If
  Calc! = Res!
End Function

Sub Camembert (Image As Control, Table(), Texte$(), Num%, x%, y%, Ra%, ExPiece%)
  Image.FillStyle = 0
  Pi = 4 * Atn(1)
  pi2 = 2 * Pi
  Somme# = 0
  Max = 0
  PartMax% = 0
  For i% = 1 To Num%
    Somme# = Somme# + Table(i%)
    If Table(i%) > Max Then Max = Table(i%): PartMax% = i%
  Next i%
  If ExPiece% = -1 Then ExPiece% = PartMax%
  AngleDebut = .0000000001
  For i% = 1 To Num%
    AngleFin = AngleDebut + (Table(i%) / Somme#)
    If AngleFin = 1 Then AngleFin = .99999
    AngleCentre = (AngleFin - AngleDebut) / 2
    CosAngle = Cos((AngleDebut + AngleCentre) * pi2)
    SinAngle = Sin((AngleDebut + AngleCentre) * pi2)
    If i% = ExPiece% Then
      w1 = ((AngleFin + AngleDebut) / 2) * pi2
      xm% = x% + Ra% / 8 * Cos(w1)
      ym% = y% - Ra% / 8 * Sin(w1)
    Else
      xm% = x%
      ym% = y%
    End If
    Image.FillColor = QBColor(i% Mod 16)
    Image.Circle (xm%, ym%), Ra%, 0, -AngleDebut * pi2, -AngleFin * pi2
    Image.CurrentX = xm% + Ra% * CosAngle + (CosAngle < 0) * Image.TextWidth(Texte$(i%))
    Image.CurrentY = ym% - Ra% * SinAngle + (SinAngle > 0) * Image.TextHeight(Texte$(i%))
    Image.Print Texte$(i%) '** Affichage du texte
    AngleDebut = AngleFin
  Next i%
End Sub

Sub Digit (Image As Control, ByVal Valeur$, ByVal NbDigit%, ByVal coulallum!, ByVal couleteint!, ByVal coulfonds!)
  Dim DigitPoint As Integer
  Dim DigitHt   As Integer
  Dim DigitLg   As Integer
  Dim DigitDecV As Integer
  Dim DigitDecH As Integer
  Dim DigitEpV  As Integer
  Dim DigitEpH  As Integer
  DigitPoint = InStr(Valeur$, ".")
  Valeur$ = UCase$(Valeur$)
  If DigitPoint > 0 Then
    DigitDummy = ""
    For i = 1 To Len(Valeur$)
      If Mid$(Valeur$, i, 1) <> "." Then
        DigitDummy = DigitDummy + Mid$(Valeur$, i, 1)
      End If
    Next i
    Valeur$ = DigitDummy
  End If
  If NbDigit% = 0 Then
    NbDigit% = Len(Valeur$)
  End If
  If NbDigit% = 0 Then NbDigit% = 1
  Image.FillStyle = 0
  Image.ScaleMode = 3
  Image.BackColor = coulfonds!
  DigitHt = Fix(Image.Height * .9 / Screen.TwipsPerPixelY)
  DigitLg = Fix(Image.Width / (NbDigit * Screen.TwipsPerPixelX))
  DigitDecV = DigitHt * .08
  DigitDecH = DigitLg * .18
  DigitEpV = DigitHt * .03
  DigitEpH = DigitLg * .03
  DigitK = 1.5
  For i = 1 To NbDigit%
    If Len(Valeur$) >= i Then
      Digitch = Mid$(Valeur$, i, 1)
    Else
      Digitch = "0"
    End If
    If i = DigitPoint Then
      '** Les chiffres aprs la virgule sont plus petits:
      DigitHt = DigitHt * .9
    End If
    Select Case Digitch
    Case "-"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
    Case "0"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), couleteint!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "1"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), couleteint!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "2"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
    Case "3"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "4"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "5"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "6"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "7"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), couleteint!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "8"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "9"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "A"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "B"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "C"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), couleteint!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
    Case "D"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
    Case "E"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
    Case "F"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), coulallum!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), couleteint!, BF
    Case "H"
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitDecV + DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt - DigitDecV)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt - DigitDecV - DigitEpV), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH + DigitEpH * DigitK, DigitHt / 2 - DigitEpV / 2)-(i * DigitLg - DigitDecH - DigitEpH * DigitK, DigitHt / 2 + DigitEpV / 2), coulallum!, BF
      '
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitDecV + DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 - DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitDecV + DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 - DigitEpV * DigitK), couleteint!, BF
      Image.Line ((i - 1) * DigitLg + DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-((i - 1) * DigitLg + DigitDecH + DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF
      Image.Line (i * DigitLg - DigitDecH, DigitHt - DigitDecV - DigitEpV * DigitK)-(i * DigitLg - DigitDecH - DigitEpH, DigitHt / 2 + DigitEpV * DigitK), coulallum!, BF    End Select
    End Select
    '
    If DigitPoint = i Then
      Image.FillColor = coulallum!
      Image.FillStyle = 0
      Image.Circle ((i - 1) * DigitLg + DigitDecH / 4, DigitHt * .98), DigitEpV * 1.1, coulallum!
    Else
      Image.FillColor = couleteint!
      Image.FillStyle = 0
      Image.Circle ((i - 1) * DigitLg + DigitDecH / 4, DigitHt * .98), DigitEpV * 1.1, couleteint!
    End If
  Next i
End Sub

Function ExtractB (ByVal Couleur)
  '** Extrait la composante Bleue d'une couleur
  Couleur = Couleur Mod 16777216
  ExtractB = (Couleur - ExtractR(Couleur) - ExtractG(Couleur) * 256) / 65536
End Function

Function ExtractG (ByVal Couleur)
  '** Extrait la composante Verte d'une couleur
  Couleur = Couleur Mod 16777216
  ExtractG = ((Couleur - ExtractR(Couleur)) / 256) Mod 256
End Function

Function ExtractR (ByVal Couleur)
  '** Extrait la composante Rouge d'une couleur
  Couleur = Couleur Mod 16777216
  ExtractR = (Couleur Mod 65536) Mod 256
End Function

Function NomCouleur$ (ByVal NCouleur&)
  '** Composantes des couleurs:
  Nb% = ExtractB(NCouleur&)
  Nr% = ExtractR(NCouleur&)
  Ng% = ExtractG(NCouleur&)
  '** moyenne des composantes (=luminosit):
  NMoy% = (Nb% + Nr% + Ng%) / 3
  '** ecart des composantes avec la moyenne:
  NEb% = Nb% - NMoy%
  NEr% = Nr% - NMoy%
  NEg% = Ng% - NMoy%
  If Abs(NEb%) < 7 And Abs(NEr%) < 7 And Abs(NEg%) < 7 Then
    '** On a identifi un gris:
    If NMoy% > 235 Then NomCouleur$ = "Blanc"
    If NMoy% <= 235 And NMoy% > 160 Then NomCouleur$ = "Gris clair"
    If NMoy% <= 160 And NMoy% > 100 Then NomCouleur$ = "Gris"
    If NMoy% <= 100 And NMoy% >= 20 Then NomCouleur$ = "Gris fonc"
    If NMoy% < 20 Then NomCouleur$ = "Noir"
  Else
    '** On a  faire  une couleur pas grise!
    '** Il y a donc une teinte dominantes:
    If Nb% >= Nr% And Nb% >= Ng% Then
      '** Le bleu est dominant:
      '** Le bleu domine t'il seul ?
      If Nb% > NMoy% * 2.1 Then
        If Nb% >= 150 Then NomCouleur$ = "Bleu"
        If Nb% < 150 Then NomCouleur$ = "Bleu fonc"
      Else
        If Abs(Nr% - Ng%) < 5 Then
          '** Les deux autres couleurs sont equivalentes:
          If (Nr% + Ng%) / 2 < 20 Then
            '** elles sont faibles:
            If Nb% >= 150 Then NomCouleur$ = "Bleu"
            If Nb% < 150 Then NomCouleur$ = "Bleu fonc"
          Else
            '** elles sont influentes:
            If Nb% >= 150 Then NomCouleur$ = "Bleu clair"
            If Nb% < 150 Then NomCouleur$ = "Bleu"
          End If
        Else
          '** Il faut prendre en compte l'autre couleur
          If Nr% > Ng% Then
            '** L'autre couleur est le rouge
            If Nb% >= 160 Then NomCouleur$ = "Violet-bleu clair"
            If Nb% < 160 And Nb% >= 100 Then NomCouleur$ = "Violet-bleu"
            If Nb% < 100 Then NomCouleur$ = "Violet-bleu fonc"
          Else
            '** L'autre couleur est le vert
            If Nb% >= 140 Then NomCouleur$ = "Bleu ciel"
            If Nb% < 140 And Nb% >= 90 Then NomCouleur$ = "Bleu"
            If Nb% < 90 Then NomCouleur$ = "Bleu fonc"
          End If
        End If
      End If
    End If
    '
    If Nr% >= Nb% And Nr% >= Ng% Then
      '** Le rouge est dominant:
      '** Le rouge domine t'il seul ?
      If Nr% > NMoy% * 2.3 Then
        If Nr% >= 150 Then NomCouleur$ = "Rouge"
        If Nr% < 150 Then NomCouleur$ = "Rouge fonc"
      Else
        If Abs(Nb% - Ng%) < 5 Then
          '** Les deux autres couleurs sont equivalentes:
          If (Nb% + Ng%) / 2 < 20 Then
            '** elles sont faibles:
            If Nr% >= 150 Then NomCouleur$ = "Rouge"
            If Nr% < 150 Then NomCouleur$ = "Rouge fonc"
          Else
            '** elles sont influentes:
            If Nr% >= 150 Then NomCouleur$ = "Rose"
            If Nr% < 150 Then NomCouleur$ = "Rouge"
          End If
        Else
          '** Il faut prendre en compte l'autre couleur
          If Nb% > Ng% Then
            '** L'autre couleur est le bleu
            If Nr% >= 160 Then NomCouleur$ = "Violet clair"
            If Nr% < 160 And Nr% >= 100 Then NomCouleur$ = "Violet"
            If Nr% < 100 Then NomCouleur$ = "Violet fonc"
          Else
            '** L'autre couleur est le vert
            If Ng% * 1.5 < Nr% Then
              If Ng% >= 170 Then NomCouleur$ = "Jaune"
              If Ng% < 170 And Ng% >= 120 Then NomCouleur$ = "Orange"
              If Ng% < 120 Then NomCouleur$ = "Marron"
            Else
              If Ng% >= 170 Then NomCouleur$ = "Jaune"
              If Ng% < 170 And Ng% >= 140 Then NomCouleur$ = "Marron"
              If Ng% < 140 Then NomCouleur$ = "Kaki"
            End If
          End If
        End If
      End If
    End If
    '
    If Ng% > Nr% And Ng% >= Nb% Then
      '** Le vert est dominant:
      '** Le vert domine t'il seul ?
      If Ng% > NMoy% * 2.1 Then
        If Ng% >= 190 Then NomCouleur$ = "Vert clair"
        If Ng% < 190 And Ng% >= 120 Then NomCouleur$ = "Vert"
        If Ng% < 120 Then NomCouleur$ = "Vert fonc"
      Else
        If Abs(Nr% - Nb%) < 5 Then
          '** Les deux autres couleurs sont equivalentes:
          If (Nr% + Nb%) / 2 < 20 Then
            '** elles sont faibles:
            If Ng% >= 190 Then NomCouleur$ = "Vert clair"
            If Ng% < 190 And Ng% >= 120 Then NomCouleur$ = "Vert"
            If Ng% < 120 Then NomCouleur$ = "Vert fonc"
          Else
            '** elles sont influentes:
            If Ng% >= 150 Then NomCouleur$ = "Vert clair"
            If Ng% < 150 Then NomCouleur$ = "Vert"
          End If
        Else
          '** Il faut prendre en compte l'autre couleur
          If Nr% > Nb% Then
            '** L'autre couleur est le rouge
            If Ng% >= 160 Then NomCouleur$ = "Vert clair"
            If Ng% < 160 And Ng% >= 100 Then NomCouleur$ = "Vert kaki"
            If Ng% < 100 Then NomCouleur$ = "Vert kaki fonc"
          Else
            '** L'autre couleur est le bleu
            If Ng% >= 180 Then NomCouleur$ = "Bleu-vert clair"
            If Ng% < 180 And Ng% >= 120 Then NomCouleur$ = "Bleu-vert"
            If Ng% < 120 Then NomCouleur$ = "Bleu-vert fonc"
          End If
        End If
      End If
    End If
    '
  End If
End Function

