Winfrom之MaskedText(高级文本框)
主要属性:
Mask(设置输入的格式,以及规则)
BeepOnError(输入错误字符会有提示音)
PassWordChar(设置密码字符为:“\0”取消字符)
主要代码:
(mtxtYouBian:控件的名称)
mtxtYouBian.BeepOnError = true;//输入错误提示音
mtxtYouBian.CutCopyMaskFormat = MaskFormat.IncludePromptAndLiterals;//制定相应规则
mtxtYouBian.RejectInputOnFirstFailure = true;
//IncludePrompt 只包括输入文本 不包括掩码字符
//IncludeLiterals 只包括输入文本 掩码字符
//ExcluedPromptAndLiterals 只包括输入文本
mtxtYouBian.TextMaskFormat = MaskFormat.IncludePrompt;//设置错误提示音
mtxtYouBian.PasswordChar = '*';//设置密码字符
mtxtYouBian.PasswordChar = '\0';//取消密码字符


浙公网安备 33010602011771号