checkedListBox
checkedListBox一键删除多个选中items
private void button3_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { checkedListBox1.Items.RemoveAt(i); i--; } }
checkedListBox反选
private void button11_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { checkedListBox1.SetItemChecked(i, false); } else { checkedListBox1.SetItemChecked(i, true); } } }