提交当前本机整理版本
This commit is contained in:
@@ -2228,4 +2228,32 @@ namespace Lskj.PubProductSmart
|
||||
// 只允许输入一个负号
|
||||
if ((e.KeyChar == '-') && ((sender as TextEdit).Text.IndexOf('-') > -1))
|
||||
{
|
||||
e.Handl
|
||||
e.Handled = true;
|
||||
}
|
||||
// 只允许输入一个百分号
|
||||
if ((e.KeyChar == '%') && ((sender as TextEdit).Text.IndexOf('%') > -1))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 限制數值框粘貼不能粘貼中文
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnIntEditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
|
||||
{
|
||||
string newText = e.NewValue as string;
|
||||
|
||||
|
||||
// 第一个输入负号不会取消,出现了千位分隔符不会取消更改,末尾为百分号不会取消
|
||||
if (!newText.Equals("-") && !string.IsNullOrEmpty(newText) && !Regex.IsMatch(newText, @"^(?:-(?:[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)|[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)(?:%)?$"))
|
||||
{
|
||||
e.Cancel = true; // 取消这次更改
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user