public FlagCheckedListBoxItem Add(FlagCheckedListBoxItem item)
 {
     Items.Add(item);
     return item;
 }
 public bool IsMemberFlag(FlagCheckedListBoxItem item)
 {
     return (IsFlag && ((_value & item._value) == _value));
 }
 public FlagCheckedListBoxItem Add(int value, string caption)
 {
     FlagCheckedListBoxItem item = new FlagCheckedListBoxItem(value, caption);
     Items.Add(item);
     return item;
 }
        protected void UpdateCheckedItems(FlagCheckedListBoxItem item, CheckState checkState)
        {
            if (item._value == 0)
                UpdateCheckedItems(0);

            int sumValue = 0;
            for (int x = 0; x < Items.Count; x++)
            {
                FlagCheckedListBoxItem i = Items[x] as FlagCheckedListBoxItem;
                if (GetItemChecked(x))
                    sumValue |= i._value;
            }

            if (checkState == CheckState.Unchecked)
                sumValue = sumValue & (~item._value);
            else
                sumValue |= item._value;

            UpdateCheckedItems(sumValue);
        }