F fuxin198311 Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-27 #2 应这样写 if not( key in ['0'..'9'] ) then key:=#0; if not( key in ['0'..'9',#8,#13] ) then key:=#0; 我觉得就带上这两个 不过是看情况了
应这样写 if not( key in ['0'..'9'] ) then key:=#0; if not( key in ['0'..'9',#8,#13] ) then key:=#0; 我觉得就带上这两个 不过是看情况了
S steven7581 Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-27 #3 if not( key in [#48..#57] ) then key:=#0; 在onKeyPress事件中的吗?
L liyinwei Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-27 #4 就如 fuxin198311 所说 if not (key in ['0'..'9']) then key := #0;
B Buddy.Sun Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-28 #7 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in ['0'..'9']) then key := #0; end; 而在 procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; //这里KEY是WORD类型,要用#0可以用char(0) Shift: TShiftState); begin end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in ['0'..'9']) then key := #0; end; 而在 procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; //这里KEY是WORD类型,要用#0可以用char(0) Shift: TShiftState); begin end;