1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Private Sub Détail_Print(Cancel As Integer, PrintCount As Integer)
X = Me.[MonChampDe0a100].Value
' Couleurs foncées : le texte en blanc
If X >= 0 And X < 26 Then
Me.[MonChampDe0a100].BackColor = RGB(255, Int((X * 255 / 49)), 0)
Me.[MonChampDe0a100].ForeColor = RGB(255, 255, 255)
End If
' Couleurs claires: le texte en noir
If X >= 26 And X < 50 Then
Me.[MonChampDe0a100].BackColor = RGB(255, Int((X * 255 / 49)), 0)
Me.[MonChampDe0a100].ForeColor = RGB(0, 0, 0)
End If
' Couleurs claires: le texte en noir
If X > 49 And X < 85 Then
Me.[MonChampDe0a100].BackColor = RGB(Int(-5.1 * X + 510), Int(-1.9 * X + 350), 0)
Me.[MonChampDe0a100].ForeColor = RGB(0, 0, 0)
End If
' Couleurs foncées: le texte en blanc
If X > 84 And X <= 100 Then
Me.[MonChampDe0a100].BackColor = RGB(Int(-5.1 * X + 510), Int(-1.9 * X + 350), 0)
Me.[MonChampDe0a100].ForeColor = RGB(255, 255, 255)
End If
End Sub |
Partager