c#CheckedListBox选择个数限定
作者:互联网
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.CurrentValue == CheckState.Checked) return;//取消选中就不用进行以下操作
for (int i = 0; i < ((CheckedListBox)sender).Items.Count; i++)
{
((CheckedListBox)sender).SetItemChecked(i, false);//将所有选项设为不选中
}
e.NewValue = CheckState.Checked;//刷新
}
标签:Checked,sender,c#,个数,private,选中,CheckState,CheckedListBox 来源: https://blog.csdn.net/qq_36248777/article/details/98946128