首页 > 代码库 > LOOKupE
LOOKupE
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;using DevExpress.XtraEditors;namespace WindowsFormsApplication7{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { lookUpEdit1.Properties.DisplayMember = "ID"; lookUpEdit1.Properties.ValueMember = "Names"; lookUpEdit1.Properties.DataSource = InitData(); lookUpEdit1.Properties.NullText = "请输入"; lookUpEdit1.Properties.PopulateColumns(); lookUpEdit1.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // lookUpEdit1.Properties.ImmediatePopup = true; lookUpEdit1.ItemIndex = -1; lookUpEdit1.Properties.Columns[0].Caption = "ID 号码"; lookUpEdit1.Properties.Columns[1].Caption = "姓名"; lookUpEdit1.Properties.Columns[1].Width = 120; lookUpEdit1.Properties.Columns[2].Width = 300; lookUpEdit1.Properties.Columns[2].Alignment = DevExpress.Utils.HorzAlignment.Center; // lookUpEdit1.Properties.Columns[2]. //控制选择项的总宽度 lookUpEdit1.Properties.PopupWidth = 500; } private List<per> InitData() { List<per> list = new List<per>(); list.AddRange(new per[] { new per("12", "zwj1"), new per("123", "zwj33"), new per("12345", "z4wj3"), new per("123456", "zwj3123") }); return list; } private void lookUpEdit1_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { } private void lookUpEdit1_EditValueChanged(object sender, EventArgs e) { this.Text = (sender as LookUpEdit).Text; this.Text += "*******" + lookUpEdit1.Text + "--" + lookUpEdit1.EditValue; } } public class per { public per(string id, string names) { this.ID = id; this.Names = names; } public string ID { get; set; } public string Names { get; set; } }}
LOOKupE
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。