仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便
Posted yunyun0574
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便相关的知识,希望对你有一定的参考价值。
先上效果图:
控件调用示例:(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;
如需源码,扫描购买,邮件发送!
以上是关于仿LookUpEdit多列模糊搜索,功能比GridLookUpEdit强大,比SearhLookUpEdit方便的主要内容,如果未能解决你的问题,请参考以下文章
如何给DevExpress的LookUpEdit控件绑定多列数据
关于DevExpress的LookUpEdit控件的搜索的一个问题,请都进来看一下
dev lookupedit 和Windows ComboBox获取多列数据