【VISUAL VB.NET】Item Box Color

Public Class Form1 Public Sub New() MyBase.New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBox1.DrawMode = DrawMode.OwnerDrawFixed End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged End Sub Private Sub ListBox1_QueryContinueDrag(sender As Object, e As QueryContinueDragEventArgs) Handles ListBox1.QueryContinueDrag End Sub Private Sub ListBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ListBox1.DrawItem e.DrawBackground() Dim g As Graphics = e.Graphics Dim color__1 As Color = Color.Blue For i As Integer = 0 To ListBox1.Items.Count - 1 g.DrawString("ListBoxItem", e.Font, New SolidBrush(color__1), New PointF(e.Bounds.X, e.Bounds.Y)) Next e.DrawFocusRectangle() End Sub End Class

No comments:

Contact Form

Name

Email *

Message *