permet 2 mode d'affichage en fonction de l'etat de IsLED
utilisation des property
suivant la valeur de Orange et de Rouge on modifie les limites min pour des couleurs
sinon pour modifier la valeur d'affichage on modifie Value
Source / Exemple :
Option Explicit
Dim val As Integer
Dim roug As Integer
Dim orang As Integer
Dim LED As Boolean
Dim lrect, hrect, nbrect
Public Property Get Rouge() As Integer
Rouge = roug
End Property
Public Property Let Rouge(ByVal new_value As Integer)
roug = new_value
Value = val
End Property
Public Property Get IsLED() As Boolean
IsLED = LED
End Property
Public Property Let IsLED(ByVal new_value As Boolean)
LED = new_value
Value = val
End Property
Public Property Get Orange() As Integer
Orange = orang
End Property
Public Property Let Orange(ByVal new_value As Integer)
orang = new_value
Value = val
End Property
Public Property Get Value() As Integer
Value = val
End Property
Public Property Let Value(ByVal new_value As Integer)
Dim v, i, j
If (new_value > 100) Then
val = 100
Else
val = new_value
End If
v = val * nbrect / 100
v = Int(v)
If (val <= orang) Then
'' vert seulement
For i = 0 To v - 1
If (Not LED) Then
Shape1(i).FillColor = &HFF00&
Else
Shape1(i).FillColor = &HFF00&
End If
Shape1(i).Visible = True
Next i
Else
'' vert + orange
If (val > orang And val <= roug) Then
For i = 0 To orang * nbrect / 100
'vert
If (Not LED) Then
Shape1(i).FillColor = &HFF00&
Else
Shape1(i).FillColor = &HFF00&
End If
Shape1(i).Visible = True
Next i
For i = orang * nbrect / 100 To v - 1
'orange
If (Not LED) Then
Shape1(i).FillColor = &H80FF&
Else
Shape1(i).FillColor = &H80FF&
End If
Shape1(i).Visible = True
Next i
Else
'' vert + orange+ rouge
For i = 0 To orang * nbrect / 100
'vert
If (Not LED) Then
Shape1(i).FillColor = &HFF00&
Else
Shape1(i).FillColor = &HFF00&
End If
Shape1(i).Visible = True
Next i
For i = orang * nbrect / 100 To roug * nbrect / 100
'orange
If (Not LED) Then
Shape1(i).FillColor = &H80FF&
Else
Shape1(i).FillColor = &H80FF&
End If
Shape1(i).Visible = True
Next i
'rouge
For i = roug * nbrect / 100 To v
Shape1(i).FillColor = 255
Shape1(i).Visible = True
Next i
End If
End If
For j = v To nbrect - 1
If (Not LED) Then
Shape1(j).Visible = False
Else
If (j * 100 / nbrect <= orang) Then
'' vert seulement
Shape1(j).FillColor = &H4000&
Shape1(j).Visible = True
Else
If (j * 100 / nbrect > orang And j * 100 / nbrect < roug) Then
'' orange
Shape1(j).FillColor = &HC0&
Shape1(j).Visible = True
Else
'' rouge
Shape1(j).FillColor = &H404080
Shape1(j).Visible = True
End If
End If
End If
Next j
End Property
Private Sub UserControl_Initialize()
orang = 55
IsLED = False
roug = 80
End Sub
Private Sub UserControl_Resize()
Dim i, esp, ebord
hrect = UserControl.ScaleHeight - 4
ebord = 2
esp = 0
lrect = 2
nbrect = (UserControl.ScaleWidth - 2 * ebord) / (esp + lrect)
If (nbrect <> Int(nbrect)) Then
nbrect = Int(nbrect) + 1
End If
Shape1(0).Width = lrect
Shape1(0).Height = hrect
For i = 1 To nbrect
On Error Resume Next
Load Shape1(i)
Next i
For i = 0 To nbrect - 1
Shape1(i).Top = 2
Shape1(i).Width = lrect
Shape1(i).Left = ebord + i * (esp + lrect)
Shape1(i).Visible = False
Shape1(i).FillColor = &HC000&
Shape1(i).BorderStyle = 0
Shape1(i).FillStyle = 0
Next i
Line1.X1 = UserControl.ScaleWidth - 1
Line1.X2 = 0
Line1.Y1 = 0
Line1.Y2 = 0
Line2.X1 = UserControl.ScaleWidth - 1
Line2.X2 = UserControl.ScaleWidth - 1
Line2.Y1 = UserControl.ScaleHeight - 1
Line2.Y2 = 0
Line3.X1 = UserControl.ScaleWidth - 1
Line3.X2 = 0
Line3.Y1 = UserControl.ScaleHeight - 1
Line3.Y2 = UserControl.ScaleHeight - 1
Line4.X1 = 0
Line4.X2 = 0
Line4.Y1 = UserControl.ScaleHeight - 1
Line4.Y2 = 0
Value = 70
End Sub
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.