private void ResetItemsCheckedState(PackageSourceCheckedListBox checkedListBox, BindingSource bindingSource)
        {
            var list = (IList <PackageSourceContextInfo>)bindingSource.List;

            for (int i = 0; i < list.Count; i++)
            {
                var isEnabled = list[i].IsEnabled;
                checkedListBox.SetItemChecked(i, isEnabled);
            }
        }
コード例 #2
0
        private void TogglePackageSourceEnabled(int itemIndex, PackageSourceCheckedListBox currentListBox)
        {
            if (itemIndex < 0 || itemIndex >= currentListBox.Items.Count)
            {
                return;
            }

            var item = (Configuration.PackageSource)currentListBox.Items[itemIndex];

            item.IsEnabled = !item.IsEnabled;

            currentListBox.Invalidate(GetCheckBoxRectangleForListBoxItem(currentListBox, itemIndex));
        }
        private Rectangle GetCheckBoxRectangleForListBoxItem(PackageSourceCheckedListBox currentListBox, int itemIndex)
        {
            const int edgeMargin = 8;

            var itemRectangle = currentListBox.GetItemRectangle(itemIndex);

            // this is the bound of the checkbox
            var checkBoxRectangle = new Rectangle(
                itemRectangle.Left + edgeMargin + 2,
                itemRectangle.Top + edgeMargin,
                currentListBox.CheckBoxSize.Width,
                currentListBox.CheckBoxSize.Height);

            return(checkBoxRectangle);
        }
 public CheckedListBoxAccessibleObject(PackageSourceCheckedListBox owner) : base(owner)
 {
 }