}
#region events
+ static object ItemCheckEvent = new object ();
+
[Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler Click {
remove { base.ValueMemberChanged -= value; }
}
- public event ItemCheckEventHandler ItemCheck;
+ public event ItemCheckEventHandler ItemCheck {
+ add { Events.AddHandler (ItemCheckEvent, value); }
+ remove { Events.RemoveHandler (ItemCheckEvent, value); }
+ }
#endregion Events
#region Public Properties
public override SelectionMode SelectionMode {
get { return base.SelectionMode; }
set {
+ if (!Enum.IsDefined (typeof (SelectionMode), value))
+ throw new InvalidEnumArgumentException ("value", (int) value, typeof (SelectionMode));
+
if (value == SelectionMode.MultiSimple || value == SelectionMode.MultiExtended)
- throw new InvalidEnumArgumentException ("Multi selection modes not supported");
+ throw new ArgumentException ("Multi selection not supported on CheckedListBox");
base.SelectionMode = value;
}
protected virtual void OnItemCheck (ItemCheckEventArgs ice)
{
- if (ItemCheck != null)
- ItemCheck (this, ice);
+ ItemCheckEventHandler eh = (ItemCheckEventHandler)(Events [ItemCheckEvent]);
+ if (eh != null)
+ eh (this, ice);
}
protected override void OnKeyPress (KeyPressEventArgs e)
#endregion Private Methods
- public class ObjectCollection : ListBox.ObjectCollection
+ public new class ObjectCollection : ListBox.ObjectCollection
{
private CheckedListBox owner;