edit编辑框只能输入数字和一个小数点

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
ifnot(Key in [#48 .. #57, #8, #46]) then//#48-#57[0-9],#8[删除键],#49[小数点]
Key :
= #0;                      //#0[什么也不做]
if (Key ='.') and (pos('.', Edit1.Text) >0) then
Key :
= #0;
end;
原文地址:https://www.cnblogs.com/lilongjiang/p/2098586.html