procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (ssCtrl in shift) And (Key=VK_RETURN) then begin ShowMessage('OK!'); end end;
我现在需要的是ctrl+键盘上的'C'
是a+b的话就使用keydown和keyup加一个标志变量组合就可以实现了
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (ssCtrl in shift) And (Key=C的键值) then begin ShowMessage('OK!'); end end;
{ VK_0 thru VK_9 are the same as ASCII '0' thru '9' ($30 - $39) } { VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' ($41 - $5A) }
Shift: TShiftState);
begin
if (ssCtrl in shift) And (Key=VK_RETURN) then
begin
ShowMessage('OK!');
end
end;
Shift: TShiftState);
begin
if (ssCtrl in shift) And (Key=C的键值) then
begin
ShowMessage('OK!');
end
end;
{ VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' ($41 - $5A) }