Пример #1
0
        /// <summary>
        /// 角度输入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void AngleKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)46 || e.KeyChar == (char)45)
            {
                switch (e.KeyChar)
                {
                    //小数点
                    case (char)46:
                        if (textBox.Text.Contains((char)46))
                        {
                            textBox.SelectionStart = textBox.Text.IndexOf((char)46) + 1;
                            textBox.SelectionLength = 0;
                            e.Handled = true;
                        }
                        break;
                    //负号
                    case (char)45:
                        if (!textBox.Text.Contains((char)45))
                        {
                            textBox.Text = "-" + textBox.Text;
                        }
                        textBox.SelectionStart = textBox.Text.IndexOf((char)45) + 1;
                        textBox.SelectionLength = 0;
                        e.Handled = true;
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            //add by dwq 2015-06-01 对含有负号的情况特殊处理
                            if (textBox.Text.Contains("-"))
                            {
                                //负号的索引
                                int negIdx = textBox.Text.IndexOf((char)45);

                                //不能再负号前面输入数字
                                if (textBox.SelectionStart + textBox.SelectionLength <= negIdx)
                                {
                                    e.Handled = true;
                                    break;  //不再进行后续处理
                                }
                            }

                            double num = double.Parse(textBox.Text.Remove(textBox.SelectionStart, textBox.SelectionLength).Insert(textBox.SelectionStart, e.KeyChar.ToString()));

                            if (num > 360 || num < -360)
                            {
                                e.Handled = true;
                            }
                            //if (textBox.SelectedText.Contains((char)46) || textBox.SelectedText.Contains((char)45))
                            //{
                            //    e.Handled = true;
                            //}
                        }

                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "请输入合法的角度数据!");
                tf.Show();

                ////add by dwq 2015-05-27 激活父窗体
                //Form frm = UtilClass.SearchOwner(textBox) as Form;
                //frm.Activate();

                textBox.Focus();

                e.Handled = true;
            }
        }
Пример #2
0
        /// <summary>
        /// 角度离开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void AngleLeave(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if (string.IsNullOrEmpty(textBox.Text))
                return;

            double d = 0;
            if (double.TryParse(textBox.Text, out d))
            {
                textBox.Text = d.ToString();
            }
            else
            {
                TipForm tip = new TipForm(textBox, "不合法的角度数据!");
                tip.Show();

                textBox.Text = null;
            }
        }
Пример #3
0
        /// <summary>
        /// 实数输入(支持科学计数法)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void RealNumberWithSciKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            //是否是科学计数法
            bool IsSciNotation = false;
            //字母E所处位置,默认-1
            int EPosition = -1;

            //输入前文本内容
            string OriText = textBox.Text;
            int SelectionStart = textBox.SelectionStart;
            int SelectionLen = textBox.SelectionLength;

            if (OriText.ToLower().Contains("e"))
            {
                IsSciNotation = true;
                EPosition = OriText.ToLower().IndexOf("e");
            }

            //可接收的字符有数字0-9,字母E或e,退格,小数点以及负号
            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)46 || e.KeyChar == (char)45 || e.KeyChar == 'E' || e.KeyChar == 'e')
            {

                switch (e.KeyChar)
                {
                    //小数点
                    case (char)46:
                        if (IsSciNotation)
                        {
                            if (textBox.Text.Contains((char)46))
                            {
                                textBox.SelectionStart = textBox.Text.IndexOf((char)46) + 1;
                                textBox.SelectionLength = 0;
                            }

                            //不能在指数位置输入小数
                            e.Handled = true;
                        }
                        break;
                    //负号
                    case (char)45:
                        if (!textBox.Text.Contains((char)45))
                        {
                            textBox.Text = "-" + textBox.Text;
                        }
                        textBox.SelectionStart = textBox.Text.IndexOf((char)45) + 1;
                        textBox.SelectionLength = 0;
                        e.Handled = true;
                        break;
                    //科学计数法
                    case 'E':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    case 'e':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            //if (textBox.SelectedText.Contains((char)46) || textBox.SelectedText.Contains((char)45))
                            //{
                            //    e.Handled = true;
                            //}

                            //add by dwq 2015-06-01 对含有负号的情况特殊处理
                            if (textBox.Text.Contains("-"))
                            {
                                //负号的索引
                                int negIdx = textBox.Text.IndexOf((char)45);

                                //不能再负号前面输入数字
                                if (textBox.SelectionStart + textBox.SelectionLength <= negIdx)
                                {
                                    e.Handled = true;
                                }
                            }
                        }
                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "请输入合法的实数数据!");
                tf.Show();

                textBox.Focus();

                ////add by dwq 2015-05-27 激活父窗体
                //Form frm = UtilClass.SearchOwner(textBox) as Form;
                //frm.Activate();

                e.Handled = true;
            }
        }
Пример #4
0
        /// <summary>
        /// 实数离开(支持科学计数法)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void RealNumberWithSciLeave(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if (string.IsNullOrEmpty(textBox.Text))
                return;

            if (!IsSciExpressLegal(textBox.Text))
            {
                TipForm tip = new TipForm(textBox, "不合法的实数类型表达式!");
                tip.Show();

                textBox.Text = null;
            }
        }
Пример #5
0
        /// <summary>
        /// 正整数离开(支持科学计数法)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void PositiveIntegerNumberWithSciLeave(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if (string.IsNullOrEmpty(textBox.Text))
                return;

            if (IsSciExpressLegal(textBox.Text) && !(textBox.Text.Contains('-')))
            {
                //校验是否为整数
                string content = textBox.Text.ToLower();

                if (content.Contains('e'))
                {
                    int EPosition = content.IndexOf('e');
                    string basePart = content.Substring(0, EPosition);
                    string expPart = content.Substring(EPosition + 1);

                    if (basePart.Contains('.'))
                    {
                        //小数点位置
                        int dotPosition = basePart.IndexOf('.');
                        //小数位数
                        int decimalLen = basePart.Length - 1 - dotPosition;

                        int expNumber = Convert.ToInt32(expPart);

                        if (decimalLen > expNumber)
                        {
                            TipForm tip = new TipForm(textBox, "不合法的正整数类型科学计数法表达式!");
                            tip.Show();

                            textBox.Text = null;
                        }
                    }
                }
            }
            else
            {
                TipForm tip = new TipForm(textBox, "不合法的正整数数据!");
                tip.Show();

                textBox.Text = null;
            }
        }
Пример #6
0
        /// <summary>
        /// 正实数输入(支持科学计数法)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void PositiveRealNumberWithSciKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            //是否是科学计数法
            bool IsSciNotation = false;
            //字母E所处位置,默认-1
            int EPosition = -1;

            //输入前文本内容
            string OriText = textBox.Text;
            int SelectionStart = textBox.SelectionStart;
            int SelectionLen = textBox.SelectionLength;

            if (OriText.ToLower().Contains("e"))
            {
                IsSciNotation = true;
                EPosition = OriText.ToLower().IndexOf("e");
            }

            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)46 || e.KeyChar == 'E' || e.KeyChar == 'e')
            {
                switch (e.KeyChar)
                {
                    //小数点
                    case (char)46:
                        if (IsSciNotation)
                        {
                            if (textBox.Text.Contains((char)46))
                            {
                                textBox.SelectionStart = textBox.Text.IndexOf((char)46) + 1;
                                textBox.SelectionLength = 0;
                            }

                            //不能在指数位置输入小数
                            e.Handled = true;
                        }
                        break;
                    //科学计数法
                    case 'E':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    case 'e':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            if (textBox.SelectedText.Contains((char)46))
                            {
                                e.Handled = true;
                            }
                        }
                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "请输入合法的正实数数据!");
                tf.Show();

                e.Handled = true;
            }
        }
Пример #7
0
        /// <summary>
        /// 行一致离开
        /// </summary>
        /// <param name="dataGridView"></param>
        /// <returns></returns>
        private static bool RowIdentical(DataGridView dataGridView)
        {
            //add by dwq 2015-05-27 先提交最后一次输入DataGridView的数据
            if (dataGridView.IsCurrentCellDirty)
            {
                dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
            }

            List<object> objListNull = new List<object>();
            List<object> objListNotNull = new List<object>();
            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                if (!row.IsNewRow)
                {
                    for (int i = 0; i < row.Cells.Count; i++)
                    {
                        if (row.Cells[i].Value == null || row.Cells[i].Value.ToString().Trim() == string.Empty)
                        {
                            objListNull.Add(row.Cells[i].Value);
                        }
                        else
                        {
                            objListNotNull.Add(row.Cells[i].Value);
                        }
                    }
                }
                if (objListNull.Count != 0 && objListNotNull.Count != 0)
                {
                    TipForm tip = new TipForm(dataGridView, "请完整填写当前表格整行数据");
                    tip.Show();

                    if (!dataGridView.Parent.Focused)
                    {
                        dataGridView.Parent.Focus();
                    }
                    dataGridView.Focus();

                    //Form frm = UtilClass.SearchOwner(dataGridView) as Form;
                    //frm.Activate();

                    foreach (DataGridViewCell item in row.Cells)
                    {
                        if (item.Value == null)
                        {
                            dataGridView.Focus();
                            dataGridView.CurrentCell = item;
                        }
                    }
                    return false;
                }
            }
            return true;
        }
Пример #8
0
        /// <summary>
        /// 整数输入(支持科学计数法)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void IntegerNumberWithSciKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            //是否是科学计数法
            bool IsSciNotation = false;
            //字母E所处位置,默认-1
            int EPosition = -1;

            //输入前文本内容
            string OriText = textBox.Text;
            int SelectionStart = textBox.SelectionStart;
            int SelectionLen = textBox.SelectionLength;

            if (OriText.ToLower().Contains("e"))
            {
                IsSciNotation = true;
                EPosition = OriText.ToLower().IndexOf("e");
            }

            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)45 || e.KeyChar == 'E' || e.KeyChar == 'e')
            {
                switch (e.KeyChar)
                {
                    //负号
                    case (char)45:
                        if (!textBox.Text.Contains((char)45))
                        {
                            textBox.Text = "-" + textBox.Text;
                        }
                        textBox.SelectionStart = textBox.Text.IndexOf((char)45) + 1;
                        textBox.SelectionLength = 0;
                        e.Handled = true;
                        break;
                    //科学计数法
                    case 'E':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    case 'e':
                        if (IsSciNotation)
                        {
                            textBox.SelectionStart = EPosition + 1;
                            textBox.SelectionLength = 0;

                            e.Handled = true;
                        }
                        else
                        {
                            IsSciNotation = true;
                        }
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            //if (textBox.SelectedText.Contains((char)46) || textBox.SelectedText.Contains((char)45))
                            //{
                            //    e.Handled = true;
                            //}

                            //add by dwq 2015-06-01 对含有负号的情况特殊处理
                            if (textBox.Text.Contains("-"))
                            {
                                //负号的索引
                                int negIdx = textBox.Text.IndexOf((char)45);

                                //不能再负号前面输入数字
                                if (textBox.SelectionStart + textBox.SelectionLength <= negIdx)
                                {
                                    e.Handled = true;
                                }
                            }
                        }
                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "不合法的整数数据!");
                tf.Show();

                e.Handled = true;
            }
        }
Пример #9
0
        /// <summary>
        /// 实数输入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void RealNumberKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            //可接收的字符有数字0-9,退格,小数点以及负号
            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)46 || e.KeyChar == (char)45)
            {

                switch (e.KeyChar)
                {
                    //小数点
                    case (char)46:
                        if (textBox.Text.Contains((char)46))
                        {
                            textBox.SelectionStart = textBox.Text.IndexOf((char)46) + 1;
                            textBox.SelectionLength = 0;
                            e.Handled = true;
                        }
                        break;
                    //负号
                    case (char)45:
                        if (!textBox.Text.Contains((char)45))
                        {
                            textBox.Text = "-" + textBox.Text;
                        }
                        textBox.SelectionStart = textBox.Text.IndexOf((char)45) + 1;
                        textBox.SelectionLength = 0;
                        e.Handled = true;
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            //if (textBox.SelectedText.Contains((char)46) || textBox.SelectedText.Contains((char)45))
                            //{
                            //    e.Handled = true;
                            //}

                            //add by dwq 2015-06-01 对含有负号的情况特殊处理
                            if (textBox.Text.Contains("-"))
                            {
                                //负号的索引
                                int negIdx = textBox.Text.IndexOf((char)45);

                                //不能再负号前面输入数字
                                if (textBox.SelectionStart + textBox.SelectionLength <= negIdx)
                                {
                                    e.Handled = true;
                                }
                            }
                        }
                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "请输入合法的实数数据!");
                tf.Show();

                textBox.Focus();

                ////add by dwq 2015-05-27 激活父窗体
                //Form frm = UtilClass.SearchOwner(textBox) as Form;
                //frm.Activate();

                e.Handled = true;
            }
        }
Пример #10
0
        /// <summary>
        /// 正实数输入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void PositiveRealNumberKeyPress(object sender, KeyPressEventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if ((e.KeyChar > (char)47 && e.KeyChar < (char)58) || e.KeyChar == (char)8 || e.KeyChar == (char)46)
            {
                switch (e.KeyChar)
                {
                    //小数点
                    case (char)46:
                        if (textBox.Text.Contains((char)46))
                        {
                            textBox.SelectionStart = textBox.Text.IndexOf((char)46) + 1;
                            textBox.SelectionLength = 0;
                            e.Handled = true;
                        }
                        break;
                    //数字
                    default:
                        if ((e.KeyChar > (char)47 && e.KeyChar < (char)58))
                        {
                            if (textBox.SelectedText.Contains((char)46))
                            {
                                e.Handled = true;
                            }
                        }
                        break;
                }
            }
            else
            {
                TipForm tf = new TipForm(textBox, "输入的不是正实数。");
                tf.Show();

                e.Handled = true;
            }
        }
Пример #11
0
        /// <summary>
        /// (正)整数离开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void integerNumberLeave(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if (string.IsNullOrEmpty(textBox.Text))
                return;

            int d = 0;
            if (int.TryParse(textBox.Text, out d))
            {
                textBox.Text = d.ToString();
            }
            else
            {
                TipForm tip = new TipForm(textBox, "不合法的整数数据!");
                tip.Show();

                textBox.Text = null;
            }
        }
Пример #12
0
        /// <summary>
        /// 判断按钮对应的控件是否有空值
        /// </summary>
        /// <param name="btnClass">按钮控件实体类</param>
        /// <returns></returns>
        private static bool HasCtrlsNull(ButtonClass btnClass)
        {
            bool flag = false;

            if (btnClass._Controls == null || btnClass._Controls.Count < 0)
            {
                //窗体中所有控件
                Form FormOwner = UtilClass.SearchOwner(btnClass._FrmControl) as Form;
                List<Control> FormControls = UtilClass.InitControls(FormOwner);

                string[] ctrlTmps = btnClass._CtrlStr.Split(',');

                foreach (string item in ctrlTmps)
                {
                    Control FormControl = FormControls.Where(n => n.Name.Equals(item)).FirstOrDefault();

                    if (FormControl != null && FormControl.Name.Equals(item))
                    {
                        ControlClass SubCtrl = new ControlClass();
                        SubCtrl._NameSpace = btnClass._NameSpace;
                        SubCtrl._Class = btnClass._Class;
                        SubCtrl._Name = item;
                        SubCtrl._ControlType = FormControl.GetType().Name;
                        SubCtrl._FrmControl = FormControl;

                        btnClass._Controls.Add(SubCtrl);
                    }
                }
            }

            string tipFailureMsg = "请完整输入必填项信息!";
            string tipSuccessMsg = string.Empty;
            if (null != btnClass._Tips[1])
            {
                tipFailureMsg = btnClass._Tips[1].ToString();
            }
            if (null != btnClass._Tips[0])
            {
                tipSuccessMsg = btnClass._Tips[0].ToString();
            }

            foreach (ControlClass item in btnClass._Controls)
            {
                //Control ctrl = item._FrmControl;
                //获取窗体对应控件
                Control ctrl = item._FrmControl;
                if (ctrl != null)
                {
                    switch (item._ControlType.Trim().ToLower())
                    {
                        case "textbox":
                            TextBox textBox = ctrl as TextBox;
                            if (string.IsNullOrEmpty(textBox.Text))
                            {
                                if (IsCommentShow)
                                {
                                    TipForm tip = new TipForm(btnClass._FrmControl, tipFailureMsg);
                                    tip.Show();

                                    //设置焦点
                                    textBox.Focus();
                                }

                                flag = true;

                                //切换到指定TabPage
                                TabPage tabPage = UtilClass.SearchOwnerTabPage(ctrl) as TabPage;
                                TabControl tabControl = tabPage.Parent as TabControl;
                                if (tabControl.SelectedTab != tabPage)
                                {
                                    tabControl.SelectedTab = tabPage;
                                }
                                break;
                            }
                            break;
                        case "datagridview":
                            DataGridView grid = ctrl as DataGridView;
                            if (grid.Rows.Count <= 0 || grid.NewRowIndex == 0)
                            {
                                if (IsCommentShow)
                                {
                                    TipForm tip = new TipForm(btnClass._FrmControl, tipFailureMsg);
                                    tip.Show();

                                    grid.Focus();
                                }
                                flag = true;

                                //切换到指定TabPage
                                TabPage tabPage = UtilClass.SearchOwnerTabPage(ctrl) as TabPage;
                                TabControl tabControl = tabPage.Parent as TabControl;
                                if (tabControl.SelectedTab != tabPage)
                                {
                                    tabControl.SelectedTab = tabPage;
                                }
                            }

                            //判断必填数据列
                            if (grid.Rows.Count > 0)
                            {
                                int ColCount = grid.Columns.Count;

                                //获取DataGridView必填数据列索引
                                List<int> ColIndex = item._NotNullIndex;

                                foreach (DataGridViewRow row in grid.Rows)
                                {
                                    //忽略新行
                                    if (row.Index == grid.NewRowIndex)
                                        continue;

                                    for (int c = 0; c < ColIndex.Count; c++)
                                    {
                                        if (row.Cells[ColIndex[c]].Value == null || string.IsNullOrEmpty(row.Cells[ColIndex[c]].Value.ToString()))
                                        {
                                            flag = true;

                                            //切换到指定TabPage
                                            TabPage tabPage = UtilClass.SearchOwnerTabPage(ctrl) as TabPage;
                                            TabControl tabControl = tabPage.Parent as TabControl;
                                            if (tabControl.SelectedTab != tabPage)
                                            {
                                                tabControl.SelectedTab = tabPage;
                                            }

                                            TipForm tip = new TipForm(grid, string.Format("DataGridView的第{0}列不能为空!", ColIndex[c] + 1));
                                            tip.Show();

                                            grid.CurrentCell = row.Cells[ColIndex[c]];
                                            grid.BeginEdit(true);

                                            break;
                                        }
                                    }
                                    if (flag)
                                    {
                                        break;  //若一出现空数据,即刻跳出循环
                                    }
                                }
                            }
                            break;
                        default:

                            break;
                    }
                }

                if (flag)
                {
                    ////切换到指定TabPage
                    //TabPage tabPage = UtilClass.SearchOwnerTabPage(ctrl) as TabPage;

                    //TabControl tabControl = tabPage.Parent as TabControl;

                    //if (tabControl.SelectedTab != tabPage)
                    //{
                    //    tabControl.SelectedTab = tabPage;
                    //}

                    break;  //出现没有填内容的直接跳出循环
                }
            }

            if (!flag)
            {
                if (!string.IsNullOrEmpty(tipSuccessMsg))
                {
                    TipForm tip = new TipForm(btnClass._FrmControl, tipSuccessMsg);
                    tip.Show();
                }
            }

            return flag;
        }
Пример #13
0
        /// <summary>
        /// 重名离开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void DuplicationNameLeave(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;
            textBox.Text = textBox.Text.Trim();
            if (NameList.Contains(textBox.Text.Trim()))
            {
                //MessageBox.Show("名称重复,请重新命名。");
                TipForm tip = new TipForm(textBox, "名称重复,请重新命名");
                tip.Show();

                textBox.Focus();
            }
        }