ComponentFactory.Krypton.Toolkit.KryptonCheckedListBox.SetItemCheckState C# (CSharp) Method

SetItemCheckState() public method

Sets the check state of the item at the specified index.
public SetItemCheckState ( int index, CheckState value ) : void
index int The index of the item to set the state for.
value CheckState One of the CheckState values.
return void
        public void SetItemCheckState(int index, CheckState value)
        {
            // Check index actually exists
            if ((index < 0) || (index >= Items.Count))
                throw new ArgumentOutOfRangeException("index", "index out of range");

            // Is the new state different from the current checked state?
            CheckState checkedState = CheckedItems.GetCheckedState(index);
            if (value != checkedState)
            {
                // Give developers a chance to see and alter the change
                ItemCheckEventArgs ice = new ItemCheckEventArgs(index, value, checkedState);
                OnItemCheck(ice);

                // If a change is still occuring
                if (ice.NewValue != checkedState)
                {
                    CheckedItems.SetCheckedState(index, ice.NewValue);
                    _listBox.Invalidate();
                }
            }
        }
KryptonCheckedListBox