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 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load lstLyric.DrawMode = DrawMode.OwnerDrawFixed End Sub Private Sub lstLyric_DrawItem(sender As Object, e As DrawItemEventArgs) Handles lstLyric.DrawItem e.DrawBackground() Dim myBrush As Brush = Brushes.Black Select Case e.Index Case 0 myBrush = Brushes.Red Case 1 myBrush = Brushes.Orange Case 2 myBrush = Brushes.Purple End Select e.Graphics.DrawString(lstLyric.Items(e.Index).ToString(), e.Font, myBrush, e.Bounds, StringFormat.GenericDefault) e.DrawFocusRectangle() End Sub |
2020年5月17日 星期日
vb.net listbox 改變item文字顏色 [Listbox change item color]
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言