C#控件CheckListBox的使用

来源:互联网 发布:微喜帖制作软件 编辑:程序博客网 时间:2024/05/16 04:59
 /// <summary>          /// 添加项          /// </summary>          public int AddItems(object value)        {            CheckListBox1.Items.Add(value);            return CheckListBox1.Items.Count;        }        /// <summary>          /// 删除项          /// </summary>          public int RemoveItems(object value)        {            CheckListBox1.Items.Remove(value);            return CheckListBox1.Items.Count;        }           /// <summary>        /// 获取选中IP数组        /// </summary>        /// <returns></returns>        public String[] GetCheckedItem()        {            String[] strCheckedItems = new String[CheckListBox1.CheckedItems.Count];            for (int i = 0; i < CheckListBox1.CheckedItems.Count; i++)            {                if (CheckListBox1.GetItemChecked(i))                {                    strCheckedItems[i] = this.chklUpdateItem.GetItemText(chklUpdateItem.Items[i]);                }            }            return strCheckedItems;        }        CheckListBox1.Items.Clear();//清空列表 
0 0
原创粉丝点击