public void effectLederCC(LabelControl lbl, ComboBoxEdit cmb, SimpleButton btn) { setting(cost); if (cost == "1") { lbl.Visible = true; cmb.Visible = true; cmb.Focus(); } else { lbl.Visible = false; cmb.Visible = false; btn.Focus(); } }
/// <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; } }
private void TextEditValidating(object sender, CancelEventArgs e) { if (sender is TextEdit) { TextEdit edtOrigin = sender as TextEdit; if (edtOrigin.Text.Trim() != "") { try { int errCode = 0; string errorMessage = ""; if (IRAPUTSClient.Instance.ufn_OLTP_StringValid( menuInfo.Parameters, CurrentOptions.Instance.OptionTwo.T120LeafID, CurrentOptions.Instance.OptionOne.T107LeafID, edtOrigin.Text.Trim(), menuInfo.OpNode, menuInfo.Parameters, edtOrigin.TabIndex, IRAPUser.Instance.SysLogID, out errCode, out errorMessage)) { e.Cancel = false; } else { XtraMessageBox.Show( errorMessage, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); edtOrigin.Text = ""; e.Cancel = true; } } catch (Exception error) { XtraMessageBox.Show( error.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); edtOrigin.Text = ""; e.Cancel = true; } finally { RefreshTheButtonControl(); } } } if (mustAllInputButton.Enabled) { if (_buttons.Count == 1 || _buttons.Count == 2) { // 如果 mustAllInputButton 是可用的,则直接执行该按钮的点击事件, // 而不再将焦点设置到该按钮上。 mustAllInputButton.PerformClick(); } else { mustAllInputButton.Focus(); } } }