本文整理汇总了C#中System.Windows.Forms.CheckedListBox.ObjectCollection类的典型用法代码示例。如果您正苦于以下问题:C# CheckedListBox.ObjectCollection类的具体用法?C# CheckedListBox.ObjectCollection怎么用?C# CheckedListBox.ObjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CheckedListBox.ObjectCollection类属于System.Windows.Forms命名空间,在下文中一共展示了CheckedListBox.ObjectCollection类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckEveryOther_Click
private void CheckEveryOther_Click(object sender, System.EventArgs e) {
// Cycle through every item and check every other.
// Set flag to true to know when this code is being executed. Used in the ItemCheck
// event handler.
insideCheckEveryOther = true;
for (int i = 0; i < checkedListBox1.Items.Count; i++) {
// For every other item in the list, set as checked.
if ((i % 2) == 0) {
// But for each other item that is to be checked, set as being in an
// indeterminate checked state.
if ((i % 4) == 0)
checkedListBox1.SetItemCheckState(i, CheckState.Indeterminate);
else
checkedListBox1.SetItemChecked(i, true);
}
}
insideCheckEveryOther = false;
}