摘要:
1 public class TextBoxInt : TextBox 2 { 3 public TextBoxInt() 4 { 5 KeyDown += TextBoxInt_KeyDown; 6 TextChanged += TextBoxInt_TextChanged; 7 } 8 9 private void TextBoxInt_TextChanged(object sender, TextChangedEventArgs e)10 {... 阅读全文
摘要:
1 /// 2 /// 使用正则表达式限制输入 3 /// 4 public class TextBoxRegex : TextBox 5 { 6 // 正则表达式,只含有汉字、数字、字母、下划线不能以数字开头 7 private const string NamimgPattern = "^(?![0-9])[a-zA-Z0-9_\u4e00-\u9fa5]{1,30}$"; 8 9 public TextBoxRegex()10 {11 TextCha... 阅读全文