/// <summary> /// 验证控件输入键盘事件之后是否为数字 /// </summary> /// <param name="e">控件输入的键盘事件</param> /// <returns></returns> public bool ValidateNumeric(KeyPressEventArgs e) { do { if (e.KeyChar == (char)Keys.Back) { e.Handled = false; break; } if (!e.KeyChar.IsNumeric()) { e.Handled = true; break; } string newString = this.ClcNewText(e.KeyChar); e.Handled = !RegexCheck.IsDecimalInputing(newString); } while (false); return(!e.Handled); }