最全面/最安全
procedure TForm3.Edit4KeyPress(Sender: TObject; var Key: Char);
var
i:Integer;
begin
if not (key in [#48..#59,#8,#13,#46]) then
key:=#0
else
begin
if key=#13 then
begin
key:=#0;
perform(WM_NEXTDLGCTL,0,0);
end;
if key=#46 then
begin
for i:=1 to Length(Edit4.Text) do
begin
if Copy(Edit4.Text,i,1)='.' then
key:=#0;
end;
end;
end;
end;