巡
巡城浪子
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key='.'then
if pos('.',edit1.text)>0 then
begin
key:=#0;
exit;
end;
if key='-' then
if length(edit1.text)>0 then key:=#0;
if not(key in [#8,'0'..'9','.']) then key:=#0;
end;
差不多就是这样你可稍稍根据需要再改善一下.
begin
if Key='.'then
if pos('.',edit1.text)>0 then
begin
key:=#0;
exit;
end;
if key='-' then
if length(edit1.text)>0 then key:=#0;
if not(key in [#8,'0'..'9','.']) then key:=#0;
end;
差不多就是这样你可稍稍根据需要再改善一下.