procedure
TForm1.Edit1KeyPress(Sender: TObject;
var
Key: Char);
begin
if not (Key in [# 48 .. # 57 , # 8 , # 46 ]) then // # 48 - # 57 [ 0 - 9 ],# 8 [删除键],# 49 [小数点]
Key : = # 0 ; // # 0 [什么也不做]
begin
if not (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 ;
Key : = # 0 ;
end ;