Dev 控件CheckedListBoxControl元素查找方法

        /// <summary>
        /// 查找并勾选某个元素方法-按值查找
        /// </summary>
        void SetItemCheckedByValue(CheckedListBoxControl clbc, object value)
        {
            ListBoxFindItemDelegate lbfid = delegate(ListBoxFindItemArgs f) { f.IsFound = object.Equals(value, f.ItemValue); };
            int a = clbc.FindItem(0, true, lbfid);
            if (a >= 0)
                clbc.SetItemChecked(a, true);
        }
        /// <summary>
        /// 查找并勾选某个元素方法-按内容查找
        /// </summary>
        void SetItemCheckedByText(CheckedListBoxControl clbc, string text)
        {
            int a = clbc.FindString(text);
            if (a > 0)
                clbc.SetItemChecked(a, true);
        }
        /// <summary>
        /// 查找并勾选某个元素方法-按内容模糊查找
        /// </summary>
        void SetItemCheckedByMatchText(CheckedListBoxControl clbc, string text)
        {
            int a = clbc.FindStringExact(text);
            if (a > 0)
                clbc.SetItemChecked(a, true);
        }

 

posted @ 2019-11-14 10:10  倔强木偶  阅读(559)  评论(0编辑  收藏  举报