添加一个ActionList,在里面添加一个Action,设置ShortCut为F1,在OnExcute中写: procedure TForm1.Action1Execute(Sender: TObject); begin ShowMessage('F1'); end;或者添加一个ApplicationEvents控件,在OnMessage中写: procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); begin if Msg.message = WM_KEYDOWN then if Msg.wParam = VK_F1 then begin ShowMessage('F1'); end; end;
procedure TForm1.Action1Execute(Sender: TObject);
begin
ShowMessage('F1');
end;或者添加一个ApplicationEvents控件,在OnMessage中写:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message = WM_KEYDOWN then
if Msg.wParam = VK_F1 then begin
ShowMessage('F1');
end;
end;