请问怎么使Enter键和向前的键失效???急急

解决方案 »

  1.   

    你想在什么地方实现这两个键失效,是在TEDIT中吗?
      

  2.   

    // http://expert.csdn.net/Expert/topic/1779/1779021.xml?temp=.5134699 
    // 和 这贴的unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ComCtrls ;type
      TForm1 = class(TForm)
        RichEdit1: TRichEdit;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure ApplicationMessage(var Msg: TMsg; var Handled: Boolean);  public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    var
      TS: TStrings;
      i: Integer;
    begin
      RichEdit1.Clear;
      Ts := TStringList.Create;
      Ts.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Test.txt');
      for i := 0 to Ts.Count - 1 do
        RichEdit1.Lines.Add(Ts.Strings[i]);
      Application.OnMessage := ApplicationMessage ;
    end;procedure TForm1.ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
    begin
      if ((Msg.message = wm_KeyDown) and (Msg.wParam = VK_Return)) or ((Msg.message
        =
        wm_KeyDown) and (Msg.wParam = VK_Up)) then
      begin 
        Handled := True ; 
      end;
    end;end.