| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
-
- using System.ComponentModel;
- using System.Drawing;
- using System.Windows.Forms;
- namespace Dongke.WinForm.Controls
- {
- /// <summary>
- /// 身份证输入文本框
- /// </summary>
- [ToolboxBitmap(typeof(TextBox))]
- public class TxtIDCard : TextBoxCodeBase
- {
- #region 构造函数
- /// <summary>
- /// 身份证输入文本框
- /// </summary>
- public TxtIDCard()
- {
- this.Rejected = "[^0-9xX]";
- this.Regular = @"^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$";
- base.MaxLength = 18;
- base.MinLength = 15;
- }
- #endregion
- #region 重写属性
- /// <summary>
- /// 获取或设置用户可在文本框控件中键入或粘贴的最大字符数。
- /// </summary>
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public override int MaxLength
- {
- get
- {
- return base.MaxLength;
- }
- set
- {
- base.MaxLength = value;
- }
- }
- /// <summary>
- /// 获取或设置允许输入的最小长度。
- /// </summary>
- [Browsable(false)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public override int MinLength
- {
- get
- {
- return base.MinLength;
- }
- set
- {
- base.MinLength = value;
- }
- }
- #endregion
- }
- }
|