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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
Private Sub DrawLight(ByVal iStatus As Int32)
Dim i As Int32
Dim bFlag As Boolean
Dim ctrl As Control
Dim grfGraphics As Graphics
Dim bshBrush As New SolidBrush(Color.Gray)
Dim penDrawingPen As New Pen(Color.Black)
Dim SizePen As Single = 3
penDrawingPen.Width = SizePen
Select Case iStatus
'Etat de marche
Case 1
bshBrush.Color = Color.Green
'Etat : arrêt technique
Case 2
bshBrush.Color = Color.Red
'Etat : arrêt fonctionnel
Case 3
bshBrush.Color = Color.Orange
'Etat : arrêt à requalifier
Case 4
bshBrush.Color = Color.Purple
'Etat : arrêt nettoyage/changement de format
Case 5
bshBrush.Color = Color.Blue
End Select
i = 0
bFlag = False
While i < Controls.Count And bFlag = False
ctrl = Controls.Item(i)
If ctrl.Name = "pnlLight" Then
grfGraphics = ctrl.CreateGraphics()
If m_bDisplayInfos Then
If m_bLabelAlignment Then
If ctrl.Width > ctrl.Height Then
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, ctrl.Location.Y, CInt((ctrl.Width - 5) / 2), CInt((ctrl.Width - 5) / 2))
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, ctrl.Location.Y, CInt((ctrl.Width - 5) / 2), CInt((ctrl.Width - 5) / 2))
Else
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, ctrl.Location.Y, CInt((ctrl.Height - 5) / 2), CInt((ctrl.Height - 5) / 2))
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, ctrl.Location.Y, CInt((ctrl.Height - 5) / 2), CInt((ctrl.Height - 5) / 2))
End If
Else
If ctrl.Width > ctrl.Height Then
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, CInt(ctrl.Height / 10), CInt((ctrl.Width - 5) / 2), CInt((ctrl.Width - 5) / 2))
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, CInt(ctrl.Height / 10), CInt((ctrl.Width - 5) / 2), CInt((ctrl.Width - 5) / 2))
Else
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, CInt(ctrl.Height / 10), CInt((ctrl.Height - 5) / 2), CInt((ctrl.Height - 5) / 2))
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, CInt(ctrl.Height / 10), CInt((ctrl.Height - 5) / 2), CInt((ctrl.Height - 5) / 2))
End If
End If
Else
If ctrl.Width > ctrl.Height Then
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, CInt(ctrl.Height / 10), ctrl.Width - 15, ctrl.Width - 15)
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, CInt(ctrl.Height / 10), ctrl.Width - 15, ctrl.Width - 15)
Else
grfGraphics.DrawEllipse(penDrawingPen, ctrl.Location.X, CInt(ctrl.Height / 10), ctrl.Height - 15, ctrl.Height - 15)
grfGraphics.FillEllipse(bshBrush, ctrl.Location.X, CInt(ctrl.Height / 10), ctrl.Height - 15, ctrl.Height - 15)
End If
End If
penDrawingPen.Dispose()
grfGraphics.Dispose()
bFlag = True
End If
i = i + 1
End While
End Sub |
Partager