RRU*_*RUZ 12
您可以OnShortCut将TApplicationEvents组件的事件用于此任务
检查此代码
procedure TForm1.ApplicationEvents1ShortCut(var Msg: TWMKey;
var Handled: Boolean);
begin
if (Msg.CharCode = Ord('D')) and (HiWord(Msg.KeyData) and KF_ALTDOWN <> 0) and (GetKeyState(VK_CONTROL) < 0) then
begin
ShowMessage('Ctrl+Alt+D Pressed') ;
Handled := true;
end;
end;
Run Code Online (Sandbox Code Playgroud)
是的,这是可能的.您必须在表单中添加类TAction的对象.您可以为Taction指定键盘快捷键,然后将代码放在TAction的事件OnExecute中.
请注意,您无法直接向表单添加Taction,您必须在表单上放置TactionList,然后才能将Taction添加到TActionList.