//加入ItemCheck方法
this.cblChangeMode.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.SelectOne);
//加入控制是否继续的全局变量,防止进入死循环
public bool canContinue = true;
private void SelectOne(object sender, ItemCheckEventArgs e)
{
CheckedListBox clb = sender as CheckedListBox;
//勾选原选项
if (clb.CheckedIndices.Count > 0 && clb.CheckedIndices[0] == e.Index && canContinue )
{
e.NewValue = CheckState.Checked;
}
//第一次勾选
&
C# WinForm CheckedListBox实现RadioButton的单选且不可取消单选的效果
最新推荐文章于 2025-05-26 22:38:18 发布