Torna al Thread
Private Sub ComboBoxCasacata_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ComboBoxCasacata.DrawItem
Dim coloreSfondo As Color
Dim coloreCarattere As System.Drawing.Brush
Dim myFont As System.Drawing.Font
e.DrawBackground()
'e.state indica se il mouse è sopra una riga
If e.State = 1 Then
coloreSfondo = Color.DarkCyan
coloreCarattere = Brushes.White
Else
coloreCarattere = Brushes.Black
'prima riga bianca
If e.Index = 0 Then
coloreSfondo = Color.Black
Else
'distinzione tra righe pari o dispari
If ((e.Index Mod 2) <> 0) Then
coloreSfondo = Color.PaleGoldenrod
Else
coloreSfondo = Color.Black
End If
End If
End If
e.DrawBackground()
Dim rectangle As Rectangle = New Rectangle(2, e.Bounds.Top + 2, _
e.Bounds.Height, e.Bounds.Height - 4)
e.Graphics.FillRectangle(New SolidBrush(coloreSfondo), rectangle)
myFont = New Font(Me.ComboBoxCasacata.Font.FontFamily, Me.ComboBoxCasacata.Font.Size, FontStyle.Bold)
e.Graphics.DrawString(Me.ComboBoxCasacata.Items(e.Index), myFont, coloreCarattere, _
New RectangleF(e.Bounds.X + rectangle.Width, e.Bounds.Y, _
e.Bounds.Width, e.Bounds.Height))
e.DrawFocusRectangle()
End Sub