Exemplo n.º 1
0
        //输入框控制事件
        private void TextKeyUp(object sender, KeyEventArgs e)        //KeyEventArgs
        {
            int     nkey    = Convert.ToInt32(e.KeyCode);
            Control control = (Control)sender;

            if (control.Text.Trim() == "")
            {
                control.Text = ""; control.Tag = "0";
            }

            if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
            {
            }
            else
            {
                return;
            }

            try
            {
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);
                switch (control.TabIndex)
                {
                case 0:
                    if (control.Text.Trim() == "")
                    {
                        return;
                    }
                    if (_menuTag.Function_Name.Trim() == "Fun_ts_yf_ypptrk_qtrk")
                    {
                        Yp.frmShowCard(sender, ShowCardType.供货单位, 0, point, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase);
                        if (Convertor.IsNull(control.Tag, "0") != "0")
                        {
                            this.SelectNextControl((Control)sender, true, false, true, true);
                        }
                    }
                    else
                    {
                        Yp.frmShowCard_funName(sender, ShowCardType.单据往来科室, _menuTag.Function_Name, point, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase);
                        if (Convertor.IsNull(control.Tag, "0") != "0")
                        {
                            this.SelectNextControl((Control)sender, true, false, true, true);
                        }
                    }

                    break;
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }