在窗体中插入TApplicationEvents控件,然后设置它的onMessage事件即可
procedure TForm1.ApplicationEventsMessage(var Msg: tagMSG; var Handled: Boolean); var AktywnaForma: TForm; begin // 检查是否按下 CTRL 键并同时按下 F7 键 if (Msg.wParam = VK_F7) and ((GetKeyState(VK_CONTROL) and $8000) <> 0) and Assigned(Screen.ActiveForm) then begin ShowMessage('CTRL+F7'); // 在这里执行你想要的操作 end; end;
效果:
标签:控件,F7,delphi,CTRL,快捷键,var,TApplicationEvents From: https://www.cnblogs.com/yoooos/p/18141664