在输入过程这样使用:
procedure TForm1.Edit1KeyPress(Sender: TObject;
var Key: Char);
type
Tkeyword=set of char;
var
keyword:Tkeyword;
begin
keyword:=['0','1','2','3','4','5','6','7','8','9','.',#8];
if not (key in Keyword) then
begin
//如果不是以上数字
beep();
key:=char(0);
end;
end;