Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.DrawMode = DrawMode.OwnerDrawFixed
End Sub
Private Sub ListBox1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox1.DrawItem
e.DrawBackground()
Dim brush As Brush = Brushes.Black
Select Case e.Index
Case 0
brush = Brushes.Red
Exit Select
Case 1
brush = Brushes.Orange
Exit Select
Case 2
brush = Brushes.Purple
Exit Select
Case 3
brush = Brushes.Blue
Exit Select
Case 4
brush = Brushes.Olive
Exit Select
End Select
e.Graphics.DrawString(DirectCast(sender, ListBox).Items(e.Index).ToString(), e.Font, brush, e.Bounds, StringFormat.GenericDefault)
e.DrawFocusRectangle()
End Sub
End Class
Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek dileğiyle. Hoşçakalın. Bahadır ŞAHİN
0 comments:
Yorum Gönder