Select Case (e.Index)
Case 0
If Alarmlvl = 3 Then
bwcolor = Brushes.Gold
ElseIf Alarmlvl = 2 Then
bwcolor = Brushes.Black
ElseIf Alarmlvl = 1 Then
bwcolor = Brushes.BlueViolet
End If
Case 1
bwcolor = Brushes.Gold
If Alarmlvl = 3 Then
bwcolor = Brushes.Gold
ElseIf Alarmlvl = 2 Then
bwcolor = Brushes.Black
ElseIf Alarmlvl = 1 Then
bwcolor = Brushes.BlueViolet
End If
Case 2
bwcolor = Brushes.Gold
If Alarmlvl = 3 Then
bwcolor = Brushes.Gold
ElseIf Alarmlvl = 2 Then
bwcolor = Brushes.Black
ElseIf Alarmlvl = 1 Then
bwcolor = Brushes.BlueViolet
End If
End Select
e.Graphics.FillRectangle(bwcolor, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
What I tring to do is when listbox.item.add the forecolor will change according its Alarmlvl. Try to search over net, but no luck. I know if use
Select Case (e.Index)
Case 0
bwcolor = Brushes.Gold
Case 1
bwcolor = Brushes.Black
Case 2
bwcolor = Brushes.BlueViolet
End Select
e.Graphics.FillRectangle(bwcolor, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
can work..but i want the colour change according Alarmlvl and not e.index
Any idea how to work around this? Any advise is appreciated^^