protected override void OnDrawItem(DrawItemEventArgs e) { e.DrawBackground(); // yes, this is necessary if (e.Index < 0 || e.Index >= Items.Count) { return; } object value = Items[e.Index]; string valueString = m_editor.GetValueAsText(value); Brush brush = (e.Index == base.SelectedIndex) ? SystemBrushes.HighlightText : SystemBrushes.WindowText; e.Graphics.DrawString(valueString, base.Font, brush, e.Bounds); }
protected override void OnDrawItem(DrawItemEventArgs e) { e.DrawBackground(); // yes, this is necessary if (e.Index < 0 || e.Index >= Items.Count) { return; } object value = Items[e.Index]; string valueString = m_editor.GetValueAsText(value); Brush brush = (e.Index == SelectedIndex) ? SystemBrushes.HighlightText : new SolidBrush(ForeColor); e.Graphics.DrawString(valueString, Font, brush, e.Bounds); if (brush != SystemBrushes.HighlightText) { brush.Dispose(); } }