<pre> private void softListBox_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); if ((e.Index >= 0) && (e.Index < softListBox.Items.Count)) { bool isChecked = softListBox.GetItemChecked(e.Index); e.Graphics.FillRectangle(isChecked ? Brushes.LightGreen : Brushes.White, e.Bounds); e.Graphics.DrawString(softListBox.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds); } e.DrawFocusRectangle(); }
this.softListBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
protected override void OnDrawItem(DrawItemEventArgs e)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)