怎样屏蔽edit中的快捷键??/Ctrl+A 、V、C等???

解决方案 »

  1.   

    同意楼上的,在onkeypress中写个空语句的行了
      

  2.   

    但是这样的话就要针对于每个edit都要写的 方法还不是很好的学习!
      

  3.   

    angle097113(深思不解) 
     在edit的onkeypres事件中Key:=#0;
    不行啊,如果这样的话就屏蔽了所有的键了?
      
     
      

  4.   

    判断按键情况,如果是以上组合,就让Key:=#0
      

  5.   

    也是的啊 不好意思的了
    那你就判断是否等于你说的那几个键的否则的话就=#0
    怎么判断 我的thinking.....
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TEdit=Class(StdCtrls.TEdit)
      protected
        procedure KeyDown(var Key: Word; Shift: TShiftState); override;
      end;
      TForm1 = class(TForm)
        Edit1: TEdit;
        Edit2: TEdit;
        ListBox1: TListBox;
        procedure Edit1KeyDown(Sender: TObject; var Key: Word;
          Shift: TShiftState);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if (Shift=[ssCtrl]) then
        if chr(Key) in ['c','C'] then
          ListBox1.Items.Add(chr(Key));
    end;{ TEdit }procedure TEdit.KeyDown(var Key: Word; Shift: TShiftState);
    begin
      if (Shift=[ssCtrl]) then
        if chr(Key) in ['c','C'] then
          ShowMessage('asdf');
      inherited;
    end;end.
      

  7.   

    如果不是这样那就是你没说明白屏蔽edit1的Ctrl+A 、V、Cunit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Edit1: TEdit;
        procedure Edit1KeyDown(Sender: TObject; var Key: Word;
          Shift: TShiftState);
      private
        { Private declarations }
        HotKeyId: Integer;
        procedure HotKeyDown(var Msg: Tmessage); message WM_HOTKEY;  //热键消息响应
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.HotKeyDown(var Msg: Tmessage);
    begin
      if (Msg.LparamLo = MOD_CONTROL) And ((Msg.LParamHi=$41) or (Msg.LParamHi=$43) or (Msg.LParamHi=$56)) then
      begin
        UnRegisterHotKey(handle, HotKeyId);
      end;
    end;procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      RegisterHotKey(Handle, hotkeyid, MOD_CONTROL,$41);
      RegisterHotKey(Handle, hotkeyid, MOD_CONTROL,$43);
      RegisterHotKey(Handle, hotkeyid, MOD_CONTROL,$56);
    end;
      

  8.   

    先判断在写上如下语句:
      key:=0;