在OnChange事件中或OnKeyDown中判断
解决方案 »
- 请问关于怎么执行这几段ShellCode啊?
- Delphi 调用VC编写的DLL问题返回直的问题
- 很简单的问题,我一直没有解决。TWebBrowser.Create
- 移动设备Telnet至主机,如何实现附图中的效果?
- 判断edit1,请大家看看,有分
- TListView的初级问题
- listview 问题
- SAFEARRAY如何封装成Variant?
- 各位,MDI中RegisterHotKey的问题。
- 如何给数据库(Paradox)增加一个新的字段,并给于默认值?
- 我想要按tab键隐藏菜单,仔细想想,这个问题还不是那么容易解决的
- 见鬼呀!!花了两个多小时的时间找BUG,结果BUG是因为在程序中多加了一行空注释(即加了一行//),你一定不信的吧?可以照我的方法试试
if not key in [0..9,'.','-'] then
key:=char(0);
就这么简单。给分吧。
begin
if ((Key>=#32) and (Key<#255)) and (not (((Key >= '0') and (Key <= '9')) or (Key = '.') or (Key = '-')))then
Key := #0;
end;
const CanKey :Set of Char=['0'..'9',
'.',
'-','+',
Char(VK_BACK),
Char(VK_DELETE),
Char(VK_RETURN),
CHar(VK_TAB)];begin
with Edit1 do
begin
if SelStart=0 then CanKey := CanKey+['-','+']
else CanKey := CanKey -['-','+'];
if (not (Key in CanKey)) then
Key:=#0;
end;
end;
Shift: TShiftState);
if (not (key in ['0'..'9', #45,#46,#8])) then
Key := #0;
end;