怎么在form上用f1,f2等键指定某一动作!!!
用过formkeydown 
比如
        if key=112 then
          radiobutton1.Checked:=true;
        if key=113 then
          radiobutton2.Checked:=true;
        if key=114 then
          radiobutton3.Checked:=true;
但当指定动作的控件不直接在form上 而是在比如一个panel上时就没有效果
为什么??
谁帮帮我 谢谢 谢谢

解决方案 »

  1.   

    先把Form的KeyPreview设为True才能接收键盘事件,否则只能在form的子控件上接收键盘时间。
      

  2.   

    我认为最简单的方法就是在窗体上放一个MainMenu,然后再做一个菜单项,并将该菜单项的Visible属性改为Flase。在菜单项中加代码就对了。
      

  3.   

    我试了一下,没问题的。
    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key = VK_F1 then
      begin
        edit1.Text := 'f1'; //edit1在form上
        edit2.Text := 'f1'; //edit2在panel上
      end;
    end;
      

  4.   

    Form的KeyPreview设为True 表示Form先接收键盘的事件,否则
    是窗体上其他控件先接收
      

  5.   

    KeyPreview设为True,我用你的代码试过了,radiobutton3在panel1
    上,没有问题。