Example #1
0
        /// <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;
            }
        }
Example #2
0
        /// <summary>判断编辑区是否有必填项未填写
        ///
        /// </summary>
        /// <param name="CheckSaveStringArrary"></param>
        /// <param name="StrArrayList"></param>
        /// <param name="ctl"></param>
        /// <returns></returns>
        public bool GetCheckSaveCtl(List <string> CheckSaveStringArrary, List <string> StrArrayList, Control ctl)
        {
            String[] StrArray;
            String[] StrArraySave;
            for (int i = 0; i < CheckSaveStringArrary.Count; i++)
            {
                StrArraySave = CheckSaveStringArrary[i].Split(',');
                for (int j = 0; j < StrArrayList.Count; j++)
                {
                    StrArray = StrArrayList[j].Split(',');
                    switch (StrArray[2].ToString())
                    {
                    case "DevExpress.XtraEditors.TextEdit":
                        TextEdit txt = new TextEdit();
                        txt = (TextEdit)ctl.Controls.Find(StrArray[1].ToString(), true)[0];
                        if (txt.Name.Substring(3, txt.Name.Length - 3) == StrArraySave[1].ToString() && txt.Text.Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            txt.Focus();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.MemoEdit":
                        MemoEdit mTxt = new MemoEdit();
                        mTxt = (MemoEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (mTxt.Name.Substring(3, mTxt.Name.Length - 3) == StrArraySave[1].ToString() && mTxt.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            mTxt.Focus();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.LookUpEdit":
                        LookUpEdit dpl = new LookUpEdit();
                        dpl = (LookUpEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (dpl.Name.Substring(3, dpl.Name.Length - 3) == StrArraySave[1].ToString() && dpl.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            dpl.Focus();
                            dpl.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.CheckedComboBoxEdit":
                        CheckedComboBoxEdit ckcob = new CheckedComboBoxEdit();
                        ckcob = (CheckedComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (ckcob.Name.Substring(3, ckcob.Name.Length - 3) == StrArraySave[1].ToString() && ckcob.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "为必选!");
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.DateEdit":
                        DateEdit dt = new DateEdit();
                        dt = (DateEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (dt.Name.Substring(3, dt.Name.Length - 3) == StrArraySave[1].ToString() && dt.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            dt.Focus();
                            dt.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.ComboBoxEdit":
                        ComboBoxEdit Comb = new ComboBoxEdit();
                        Comb = (ComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (Comb.Name.Substring(3, Comb.Name.Length - 3) == StrArraySave[1].ToString() && Comb.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            Comb.Focus();
                            Comb.ShowPopup();
                            return(false);
                        }
                        break;

                    case "DevExpress.XtraEditors.ImageComboBoxEdit":
                        ImageComboBoxEdit imgcom = new ImageComboBoxEdit();
                        imgcom = (ImageComboBoxEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                        if (imgcom.Name.Substring(3, imgcom.Name.Length - 3) == StrArraySave[1].ToString() && imgcom.EditValue.ToString().Trim().Length == 0)
                        {
                            MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                            imgcom.Focus();
                            imgcom.ShowPopup();
                            return(false);
                        }
                        break;

                    //case "DevExpress.XtraEditors.CheckEdit":
                    //    DevExpress.XtraEditors.CheckEdit chk = new DevExpress.XtraEditors.CheckEdit();
                    //    chk = (DevExpress.XtraEditors.CheckEdit)ctl.Controls.Find(StrArray[1].ToString(), false)[0];
                    //    if (chk.Name.Substring(3, chk.Name.Length - 3) == StrArraySave[1].ToString() && chk.EditValue.ToString().Trim().Length == 0)
                    //    {
                    //        MessageBox.Show(StrArraySave[2].ToString() + "不能为空!");
                    //        chk.Focus();
                    //        return false;
                    //    }
                    //    break;
                    default:
                        break;
                    }
                }
            }
            return(true);
        }