using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; namespace CsHospital.UserControls { public partial class UserBb : UserControl { public UserBb() { InitializeComponent(); DataTable f_Bb = new DataTable(); f_Bb.Columns.Add("编号"); f_Bb.Columns.Add("名称"); f_Bb.Rows.Add("01", "血液"); f_Bb.Rows.Add("02", "尿液"); this.lookUpEdit1.Properties.DataSource = f_Bb; this.lookUpEdit1.Properties.DisplayMember = "名称"; this.lookUpEdit1.Properties.ValueMember = "编号"; } public delegate void BindTextCode(bool flag); public event BindTextCode bindTextCode; /// /// 下拉框对象 /// public DevExpress.XtraEditors.LookUpEdit lookUpEditObject { get { return lookUpEdit1; } } /// /// 回车触发下一个 /// /// /// private void textBox_KeyPress(object sender, KeyPressEventArgs e) { bool isnull = false; LookUpEdit gu = sender as LookUpEdit; if (e.KeyChar == (char)Keys.Enter) { if (string.IsNullOrWhiteSpace(gu.Text)) { isnull = true; bindTextCode(isnull); } else { SendKeys.Send("{tab}"); } } } } }