// *********************************************************************** // Assembly : HZH_Controls // Created : 2019-09-27 // // *********************************************************************** // // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com // // // Blog: https://www.cnblogs.com/bfyx // GitHub:https://github.com/kwwwvagaa/NetWinformControl // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git // // If you use this code, please keep this note. // *********************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace HZH_Controls.Controls { /// /// 验证规则 /// public enum VerificationModel { /// /// 无 /// [Description("无"), VerificationAttribute()] None = 1, /// /// 任意字母数字下划线 /// [Description("任意字母数字下划线"), VerificationAttribute(@"^[a-zA-Z_0-1]*$", "请输入任意字母数字下划线")] AnyChar = 2, /// /// 任意数字 /// [Description("任意数字"), VerificationAttribute(@"^[\-\+]?\d+(\.\d+)?$", "请输入任意数字")] Number = 4, /// /// 非负数 /// [Description("非负数"), VerificationAttribute(@"^(\+)?\d+(\.\d+)?$", "请输入非负数")] UnsignNumber = 8, /// /// 正数 /// [Description("正数"), VerificationAttribute(@"(\+)?([1-9][0-9]*(\.\d{1,2})?)|(0\.\d{1,2})", "请输入正数")] PositiveNumber = 16, /// /// 整数 /// [Description("整数"), VerificationAttribute(@"^[\+\-]?\d+$", "请输入整数")] Integer = 32, /// /// 非负整数 /// [Description("非负整数"), VerificationAttribute(@"^(\+)?\d+$", "请输入非负整数")] UnsignIntegerNumber = 64, /// /// 正整数 /// [Description("正整数"), VerificationAttribute(@"^[0-9]*[1-9][0-9]*$", "请输入正整数")] PositiveIntegerNumber = 128, /// /// 邮箱 /// [Description("邮箱"), VerificationAttribute(@"^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$", "请输入正确的邮箱地址")] Email = 256, /// /// 手机 /// [Description("手机"), VerificationAttribute(@"^(\+?86)?1\d{10}$", "请输入正确的手机号")] Phone = 512, /// /// IP /// [Description("IP"), VerificationAttribute(@"(?=(\b|\D))(((\d{1,2})|(1\d{1,2})|(2[0-4]\d)|(25[0-5]))\.){3}((\d{1,2})|(1\d{1,2})|(2[0-4]\d)|(25[0-5]))(?=(\b|\D))", "请输入正确的IP地址")] IP = 1024, /// /// Url /// [Description("Url"), VerificationAttribute(@"^[a-zA-z]+://(//w+(-//w+)*)(//.(//w+(-//w+)*))*(//?//S*)?$", "请输入正确的网址")] URL = 2048, /// /// 身份证号 /// [Description("身份证号"), VerificationAttribute(@"^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$", "请输入正确的身份证号")] IDCardNo = 4096, /// /// 正则验证 /// [Description("自定义正则表达式"), VerificationAttribute()] Custom = 8192, } }