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

LOOKupE

时间:2016-10-02 17:28:25      阅读:130      评论:0      收藏: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;
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

标签:

原文地址:http://www.cnblogs.com/xh0626/p/5927583.html

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