码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-07-30 17:33:53      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:lis   close   form   图片   string   需要   read   color   模糊   

先上效果图:

技术图片

技术图片

技术图片

控件调用示例:(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
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public frmDemo()
        {
            InitializeComponent();
            if (!DesignMode)
            {
                //控件调用示例
                List<ColumnCaption> visibleColumns = new List<ColumnCaption>() { new ColumnCaption("Id", "编号", 120), new ColumnCaption("Product", "产品", 240), new ColumnCaption("Name", "名称", 180), };
                gridLookUpEditEx1.Bind(DemoData(), "Id", "Product", visibleColumns, DealResult);
            }
        }

        /// <summary>
        /// 委托调用
        /// </summary>
        /// <param name="result"></param>
        private void DealResult(string result)
        {
            textEdit1.EditValue = gridLookUpEditEx1.Text;
            textEdit2.EditValue = gridLookUpEditEx1.EditValue;
        }

        /// <summary>
        /// 测试数据
        /// </summary>
        /// <returns></returns>
        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;
        }

        /// <summary>
        /// 测试数据
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        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;
        }

        /// <summary>
        /// 测试数据
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        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

如需源码,扫描购买,邮件发送!

技术图片

 

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

标签:lis   close   form   图片   string   需要   read   color   模糊   

原文地址:https://www.cnblogs.com/yunyun0574/p/11271241.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!