/// <summary> /// Overriden draw method that doesn't allow highlighting of the selected item since that obscures the item's text color which has desired meaning. But the /// selected item is still known to the user by the focus rectangle being displayed. /// </summary> /// <param name="e"></param> protected override void OnDrawItem(DrawItemEventArgs e) { if (this.DesignMode) { base.OnDrawItem(e); } else { if (e.Index == -1) { return; } Color textColor = this.GetItemCheckState(e.Index) == CheckState.Unchecked ? UncheckedColor : (this.GetItemCheckState(e.Index) == CheckState.Checked ? CheckedColor : IndeterminateColor); DrawItemEventArgs e2 = new DrawItemEventArgs (e.Graphics, e.Font, new Rectangle(e.Bounds.Location, e.Bounds.Size), e.Index, (e.State & DrawItemState.Focus) == DrawItemState.Focus ? DrawItemState.Focus : DrawItemState.None, /* Remove 'selected' state so that the base.OnDrawItem doesn't obliterate the work we are doing here. */ textColor, this.BackColor); base.OnDrawItem(e2); e2.Dispose(); } }