CheckedListBoxControl 使用

 

 

绑定用法

CheckedListBoxControl 使用
  StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select id, filename, addtime from gf_mxd");

           //gridControl1.DataSource =

          cklbxList.DataSource = BaseApp.DBOper.dbhelper.DoQueryEx("tb", sb.ToString(), true);

          cklbxList.DisplayMember = "FILENAME";

          cklbxList.ValueMember = "ID";
View Code

 

 

 

事件,全选与全不远

CheckedListBoxControl 使用
 private void lkbSelect_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

        {

            if (lkbSelect.Text == "全选")

            {

                int idx = 0;

                while (cklbxList.GetItemValue(idx) != null)

                {

                    cklbxList.SetItemChecked(idx, true);

                    idx++;

                }

                lkbSelect.Text = "全不选";

            }

            else

            {



                int idx = 0;

                while (cklbxList.GetItemValue(idx) != null)

                {

                    cklbxList.SetItemChecked(idx, false);

                    idx++;

                }

                lkbSelect.Text = "全选";

            }

        }
View Code

 

你可能感兴趣的:(checked)