MaskEdit的简单使用?(30分)

  • 主题发起人 主题发起人 kkkcheng
  • 开始时间 开始时间
K

kkkcheng

Unregistered / Unconfirmed
GUEST, unregistred user!
MaskEdit控件如何过滤非法字符?
我设置EditMask属性时只能选择,而且选择后运行框内总有
“——”、“[]”、“__”等不需要的字符而且不能删除。
是否我的设置错了。
 
运行框内的字符表示必须填的,这些字符都已经填好了,当然不能删除.另外过滤字符可以自己设置
查查书.
 
我要能查到就不问了?麻烦大虾发一份吧!
 
帮助里就有啊
! If a ! character appears in the mask, optional characters are
represented in the EditText as leading blanks. If a ! character
is not present, optional characters are represented in the
EditText as trailing blanks.
> If a > character appears in the mask, all characters that follow
are in uppercase until the end of the mask or until a <character
is encountered.
< If a <character appears in the mask, all characters that follow
are in lowercase until the end of the mask or until a > character
is encountered.

<> If these two characters appear together in a mask, no case checking
is done and the data is formatted with the case the user uses to
enter the data.
/ The character that follows a / character is a literal character.
Use this character to use any of the mask special characters as
a literal in the data.
L The L character requires an alphabetic character only in this
position. For the US, this is A-Z, a-z.
l The l character permits only an alphabetic character in this
position, but doesn't require it.

A The A character requires an alphanumeric character only in
this position. For the US, this is A-Z, a-z, 0-9.
a The a character permits an alphanumeric character in this
position, but doesn't require it.
C The C character requires an arbitrary character in this position.
c The c character permits an arbitrary character in this position,
but doesn't require it.
0 The 0 character requires a numeric character only in this position.
9 The 9 character permits a numeric character in this position,
but doesn't require it.

# The # character permits a numeric character or a plus or minus sign
in this position, but doesn't require it.
: The : character is used to separate hours, minutes, and seconds in
times. If the character that separates hours, minutes, and seconds
is different in the regional settings of the Control Panel utility
on your computer system, that character is used instead.
/ The / character is used to separate months, days, and years in dates.
If the character that separates months, days, and years is different
in the regional settings of the Control Panel utility on your
computer system, that character is used instead.

; The ; character is used to separate the three fields of the mask.
_ The _ character automatically inserts spaces into the text.
When the user enters characters in the field, the cursor skips
the _ character.
 
我的英文太差,别拿英文吓我!
我只想知道MaskEdit即可过滤数据又不留痕迹的中文信息。
例如,如何让它只能输入数字?
 
只输入数字用Edit就可以了

SetWindowLong(Edit1.Handle,
GWL_STYLE,GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_NUMBER);
 
设置MaskEdit的MaskEdit属性中,在inputmask中输入0,如果限制最多只能输入4个数字,
输入0000就行了,在character for blanks:输入空格就行
 
Kill Night 说的不错。
有点补充:
在inputmask 输入0时,该位置必须要有一个数字。如果输入0000,就必须填四个数字。
在inputmask 输入9时,该位置只能填数字,也可以不填!如果输入9999,你可以填123

在character for blanks:输入空格,就不留痕迹了!!

 
多人接受答案了。
 
后退
顶部