做了个自定义CheckedListBox类,想要每行颜色不同,但不作用,请问错在哪?
我的想法是单数行黑色字,双数行红色字,但不起作用,也不出错,用的是VS2003不行 ,在VS2008上试了可以
Protected Overloads Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs)
If e.Index Mod 2 = 0 Then
Dim e2 As DrawItemEventArgs = New DrawItemEventArgs(e.Graphics, e.Font, e.Bounds, e.Index, e.State, Color.Red, e.BackColor) ' New DrawItemEventArgs(e.Graphics, e.Font, New Rectangle(e.Bounds.Location, e.Bounds.Size), e.Index, e.State, Color.Red, e.BackColor)
MyBase.OnDrawItem(e2)
Else
MyBase.OnDrawItem(e)
End If
End Sub