Skip to content

BitMaskCheckedListBox

Radu Martin edited this page Apr 14, 2017 · 18 revisions

BitMaskCheckedListBox is a WinForms control that displays a ListBox which is bound to a BitMask and in which a check box is displayed to the left of each item.

BitMaskCheckedListBox

The BitMaskCheckedListBox implements two properties that can be bound to int or long types, implements two methods for getting and setting items that can be used with lists of more than 64 items. Also, the BitMaskCheckedListBox implements two events for catching value changes.

Properties

Default Value property is a bitmask with 32 bit capabilities. It can be used for lists with up to 32 items:

[DefaultValue(0)]
[Bindable(true), Browsable(true)]
public int Value { get; set; }

The LongValue property is a bitmask with 64 bit capabilities. It can b be used for lists with up to 64 items:

[DefaultValue(0)]
[Bindable(true), Browsable(true)]
public long LongValue { get; set; }

Methods

Method GetValues returns an array of item's states (checked/unchecked), that represents each item from BitMaskCheckedListBox:

public bool[] GetValues()

Next method called SetValues sets the item's state (checked/unchecked) for each item from BitMaskCheckedListBox:

public void SetValues(bool[] Values) 

Events

These events are raised when the Value or LongValue properties have been changed:

[BrowsableAttribute(false)]
public event EventHandler ValueChanged;

[BrowsableAttribute(false)]
public event EventHandler LongValueChanged;