[转载]C# 多选功能(checkedListBox控件)

     // 全选;
        private void btn_allSelected_Click(object sender, EventArgs e)
        {
            //this.CheckedListBox1.CheckOnClick = true;
            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                this.checkedListBox1.SetItemChecked(i, true);
            }
        }
        // 全消;
        private void btn_allCancle_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                this.checkedListBox1.SetItemChecked(i, false);
            }
        }
        // 反选
        private void btn_Unselected_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                if (checkedListBox1.GetItemChecked(i))
                {
                    this.checkedListBox1.SetItemChecked(i, false);
                }
                else
                {
                    this.checkedListBox1.SetItemChecked(i, true);         
                }         
              
            }
        }

 

相关文章:

  • 2021-08-14
  • 2022-12-23
  • 2021-05-01
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案