如题

解决方案 »

  1.   

    我的想法:
    1、用HOOK挂钩是肯定能做的到的;
    2、获取按键,在WM_Char消息事件中自己处理按键消息,过滤掉你说的那几个键!
      

  2.   

    TEdit本身的OnKeyDown事件中写代码是可以实现的,但是我是想我要自定义组件的话,这样的代码该往什么地方写?
      

  3.   

    用keypress来判断。。如果按下的是你想要屏BI的键的话就为空
    OK
      

  4.   

    在onkeypress中加入:
    if key in ['0','3','7','9'] then key:=#0;
      

  5.   

    哦 知道了
    先声明   procedure KeyPress (var Key: Char); override;
    还有property OnKeyPress;
    然后
    procedure TFlatSpinEditInteger.KeyPress (var Key: Char);
    begin
    if key in ['0','3','7','9'] then key:=#0;
      if Key <> #0 then
        inherited KeyPress(Key);
    end;
      

  6.   

    在onkeypress中加入:
    begin
      inherited;
      if key in ['0','3','7','9'] then key:=#0;
    end;
    也可以使用api函数,或者拦截消息等方法
      

  7.   

    重载TWinControl的KeyPress函数即可。
    procedure TMyEdit.KeyPress (var Key: Char);
    begin
      if key in ['0','3','7','9']
      then
        key:=#0;
      else
        inherited KeyPress(Key);
    end;
    TMyEdit是你的类名。