答案 0 :(得分:0)
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
e.DrawBackground()
If e.State = DrawItemState.Focus Then e.DrawFocusRectangle()
If e.Index < 0 OrElse e.Index >= Items.Count Then Return
Dim item As String = Items(e.Index)
Dim lists As String() = item.Split(",")
Dim brush As Brush() = {Brushes.Blue, Brushes.DarkOrange, Brushes.Black, Brushes.Red}
Dim current As String = String.Empty
e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
current = String.Join(" ", lists)
e.Graphics.DrawString(current, e.Font, Brushes.White, e.Bounds)
Else
For i As Integer = 0 To lists.Count - 1
Dim size As SizeF = e.Graphics.MeasureString(current, e.Font)
e.Graphics.DrawString(lists(i), e.Font, brush(i), size.Width, e.Bounds.Top, StringFormat.GenericDefault)
current &= lists(i) & " "
Next
End If
End Sub