仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便

先上效果图:

仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便_第1张图片

仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便_第2张图片

仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便_第3张图片

控件调用示例:(devexpress使用了16.2.6.0版本,可以根据实际需要进行版本转换)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace YRCode.Setup.DemoLookUpEdit
{
    public partial class frmDemo : Form
    {
        /// 
        /// 构造函数
        /// 
        public frmDemo()
        {
            InitializeComponent();
            if (!DesignMode)
            {
                //控件调用示例
                List visibleColumns = new List() { new ColumnCaption("Id", "编号", 120), new ColumnCaption("Product", "产品", 240), new ColumnCaption("Name", "名称", 180), };
                gridLookUpEditEx1.Bind(DemoData(), "Id", "Product", visibleColumns, DealResult);
            }
        }

        /// 
        /// 委托调用
        /// 
        /// 
        private void DealResult(string result)
        {
            textEdit1.EditValue = gridLookUpEditEx1.Text;
            textEdit2.EditValue = gridLookUpEditEx1.EditValue;
        }

        /// 
        /// 测试数据
        /// 
        /// 
        private DataTable DemoData()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Id", typeof(System.Int32));
            dt.Columns.Add("Product", typeof(System.String));
            dt.Columns.Add("Name", typeof(System.String));
            for (int i = 0; i < 30; i++)
            {
                DataRow dr = dt.NewRow();
                dr["Id"] = 100 + i;
                dr["Product"] = GetChar(i) + i.ToString() + "DLJ";
                dr["Name"] = GetName(i) + i.ToString();
                dt.Rows.Add(dr);
            }
            return dt;
        }

        /// 
        /// 测试数据
        /// 
        /// 
        /// 
        private static string GetChar(int number)
        {
            string[] array = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I" };
            string result = array[number % 9];
            return result;
        }

        /// 
        /// 测试数据
        /// 
        /// 
        /// 
        private static string GetName(int number)
        {
            string[] array =
            {
               "Unitch数据采集器","MS扫描枪","105SL","TSC","PH880","MS320便携式打印机","PA700","DSX800电脑","HP打印机"
           };
            string result = array[number % 9];
            return result;
        }
    }
}
View Code

如需源码,扫描购买,邮件发送!请先留言下您的邮箱地址:[email protected]

仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便_第4张图片

 

你可能感兴趣的:(仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便)