procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key = VK_NUMPAD2 then    edit1.Text := 's';
end;
执行后,edit中会出现'2s'这种,怎么能使edit中不响应小键盘事件,然后对小键盘相应按键进行处理。
谢谢。
不要告诉我在edit1keyup中写事件,不好用。

解决方案 »

  1.   

    你可以在它的KEYPRESS中写代码呀,
     if key=#13  then 
     begin
       ..
     end;
     你可以把小键盘中的各个键 的
      

  2.   

    你最好在OnKeyPress中写代码,因为OnKeyPress是最后一个执行的
      

  3.   

    if key= '1' then 
     begin
       ..
       Key := ' ';
     end;
    if key= '2' then 
     begin
       ..
       Key := ' ';
     end;
    ........
      

  4.   

    procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
    if key = VK_NUMPAD2 then    Key := 's';//<-------------一定要将key赋值才可以
    end;
    执行后,edit中会出现'2s'这种,怎么能使edit中不响应小键盘事件,然后对小键盘相应按键进行处理。
    谢谢。
    不要告诉我在edit1keyup中写事件,不好用。
      

  5.   

    ok,现在没有delphi,试试哦。