运行已通过 在Edit的OnKeyPress中 procedure......... begin if not (Key In['0'..'9','.',#8,#13]) then begin key:=#0; showmessage('请输入数字!'); end else if key='.' then Edit1.Maxlength:=Length(Edit1.Text)+3; else if key=#8 then if Pos('.',Edit1.text)=Length(Edit1.text) then Edit1.MaxLength:=0; end;
begin
if not(key in ['0'..'9','.',#8]) then
begin
beep;
key:=chr(0);
end;
end;
在Edit的OnKeyPress中
procedure.........
begin
if not (Key In['0'..'9','.',#8,#13]) then
begin
key:=#0;
showmessage('请输入数字!');
end
else if key='.' then
Edit1.Maxlength:=Length(Edit1.Text)+3;
else if key=#8 then
if Pos('.',Edit1.text)=Length(Edit1.text) then
Edit1.MaxLength:=0;
end;
0000.00;1;_