private void SelectDefaultButton() { if (_defaultButtonControl != null) { _defaultButtonControl.Select(); } }
void myLayoutView1_ShowCustomization(object sender, EventArgs e) { var btn = new SimpleButton(); btn.Text = "New Button"; btn.Location = new Point(250, 9); myLayoutView1.CustomizationForm.Controls[0].Controls[0].Controls[1].Controls.Add(btn); btn.Select(); }
/// <summary>回车跳转到当前控件所做的处理 /// /// </summary> /// <param name="StringArrary"></param> /// <param name="ctl"></param> public void GetPreCtl(List <string> StringArrary, string[] Ctrl, Control ctl) { switch (Ctrl[2]) { case "System.Windows.Forms.TextBox": TextBox wintxt = new TextBox(); wintxt = (TextBox)ctl.Controls.Find(Ctrl[1], true)[0]; wintxt.Focus(); wintxt.Select(); break; case "DevExpress.XtraEditors.TextEdit": TextEdit txt = new TextEdit(); txt = (TextEdit)ctl.Controls.Find(Ctrl[1], true)[0]; txt.Focus(); txt.Select(); break; case "DevExpress.XtraEditors.CheckEdit": CheckEdit ce = new CheckEdit(); ce = (CheckEdit)ctl.Controls.Find(Ctrl[1], true)[0]; ce.Focus(); ce.Checked = true; break; case "DevExpress.XtraEditors.MemoEdit": MemoEdit mTxt = new MemoEdit(); mTxt = (MemoEdit)ctl.Controls.Find(Ctrl[1], false)[0]; mTxt.Focus(); mTxt.Select(); break; case "DevExpress.XtraEditors.SimpleButton": SimpleButton btn = new SimpleButton(); btn = (SimpleButton)ctl.Controls.Find(Ctrl[1], false)[0]; btn.Focus(); btn.Select(); break; case "DevExpress.XtraEditors.LookUpEdit": LookUpEdit dpl = new LookUpEdit(); dpl = (LookUpEdit)ctl.Controls.Find(Ctrl[1], false)[0]; dpl.Focus(); dpl.ShowPopup(); break; case "DevExpress.XtraEditors.CheckedComboBoxEdit": CheckedComboBoxEdit ckcob = new CheckedComboBoxEdit(); ckcob = (CheckedComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0]; ckcob.Focus(); ckcob.Select(); ckcob.ShowPopup(); break; case "DevExpress.XtraEditors.DateEdit": DateEdit dt = new DateEdit(); dt = (DateEdit)ctl.Controls.Find(Ctrl[1], false)[0]; dt.Focus(); dt.ShowPopup(); break; case "DevExpress.XtraEditors.ComboBoxEdit": ComboBoxEdit Comb = new ComboBoxEdit(); Comb = (ComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0]; Comb.Focus(); Comb.ShowPopup(); break; case "DevExpress.XtraEditors.ImageComboBoxEdit": ImageComboBoxEdit imgcom = new ImageComboBoxEdit(); imgcom = (ImageComboBoxEdit)ctl.Controls.Find(Ctrl[1], false)[0]; imgcom.Focus(); imgcom.Select(); imgcom.ShowPopup(); break; default: break; } }