DekGenius.com
[ Team LiB ] Previous Section Next Section

CheckedListBoxmarshal by reference, disposable

System.Windows.Forms (system.windows.forms.dll)class

This control, derived from ListBox, provides a list of items with a check beside each one, providing an alternative selection mechanism. It extends the base listbox by providing you with two collection accessors: CheckedItemCollection, which returns the set of all the checked items in the list, and CheckedIndexCollection, which returns a set containing the index of each checked item in the list. You can then use the GetItemChecked() and GetItemCheckState() methods to determine the actual check state for the item.

You can support either two- or three-state checkboxes, and ThreeDCheckBoxes, or flat ones. You can also choose whether the item is checked when it is selected, or whether the checkbox itself must be clicked.

public class CheckedListBox : ListBox {
// Public Constructors
   public CheckedListBox();
// Public Instance Properties
   public CheckedIndexCollection CheckedIndices{get; }
   public CheckedItemCollection CheckedItems{get; }
   public bool CheckOnClick{set; get; }
   public override DrawMode DrawMode{set; get; } // overrides ListBox
   public override int ItemHeight{set; get; } // overrides ListBox
   public ObjectCollection Items{get; } // overrides ListBox
   public override SelectionMode SelectionMode{set; get; } // overrides ListBox
   public bool ThreeDCheckBoxes{set; get; }
// Protected Instance Properties
   protected override CreateParams CreateParams{get; } // overrides ListBox
// Public Instance Methods
   public bool GetItemChecked(int index);
   public CheckState GetItemCheckState(int index);
   public void SetItemChecked(int index, bool value);
   public void SetItemCheckState(int index, CheckState value);
// Protected Instance Methods
   protected override AccessibleObject CreateAccessibilityInstance();  // overrides Control
   protected override ObjectCollection CreateItemCollection();  // overrides ListBox
   protected override void OnBackColorChanged(EventArgs e);  // overrides Control
   protected override void OnClick(EventArgs e);  // overrides Control
   protected override void OnDrawItem(DrawItemEventArgs e);  // overrides ListBox
   protected override void OnFontChanged(EventArgs e);  // overrides ListBox
   protected override void OnHandleCreated(EventArgs e);  // overrides ListBox
   protected virtual void OnItemCheck(ItemCheckEventArgs ice);
   protected override void OnKeyPress(KeyPressEventArgs e);  // overrides Control
   protected override void OnMeasureItem(MeasureItemEventArgs e);  // overrides ListBox
   protected override void OnSelectedIndexChanged(EventArgs e);  // overrides ListBox
   protected override void WmReflectCommand(ref Message m);  // overrides ListBox
   protected override void WndProc(ref Message m);  // overrides ListBox
// Events
   public event EventHandler Click; // overrides ListBox
   public event DrawItemEventHandler DrawItem; // overrides ListBox
   public event ItemCheckEventHandler ItemCheck;
   public event MeasureItemEventHandler MeasureItem; // overrides ListBox
}

Hierarchy

System.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponen, System.IDisposable) Control(IOleContro, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, System.ComponentModel.ISynchronizeInvoke, IWin32Window) ListControl ListBox CheckedListBox

Passed To

ObjectCollection.ObjectCollection()

    [ Team LiB ] Previous Section Next Section