简体   繁体   English

C#控制台快捷方式-如何禁用?

[英]C# console shortcuts - how to disable?

I'm experimenting with the console's ConsoleKeyInfo.Modifers attribute. 我正在尝试使用控制台的ConsoleKeyInfo.Modifers属性。 While pressing different combinations of alt, ctrl, shift and normal keys I found this (ctrl+f): 按下alt,ctrl,shift和正常键的不同组合时,我发现了以下内容(ctrl + f): 在此处输入图片说明 I run other console applications and even cmd.exe. 我运行其他控制台应用程序,甚至运行cmd.exe。 The result: There are some shortcuts in all this console programms like ctrl+a, ctrl+f... Is there any way to disable these shortcuts? 结果:在所有这些控制台程序中都有一些快捷方式,例如ctrl + a,ctrl + f ...是否可以禁用这些快捷方式?

Thank you! 谢谢!

You can change some of the properties of a console window programmatically, but not those specific features you mention in your question. 您可以通过编程方式更改控制台窗口的某些属性,但不能更改问题中提到的那些特定功能。 You'd have to disable the option in the command prompt of the operating system, as @obizues has pointed out. 正如@obizues指出的那样,您必须在操作系统的命令提示符中禁用该选项。

For what it's worth, you can modify the behaviour of CTRL+C programmatically, using Console.TreatControlCAsInput = true; 对于它的价值,您可以使用Console.TreatControlCAsInput = true;编程方式修改CTRL + C的行为Console.TreatControlCAsInput = true; , which would then allow you to handle any user key sequences of CTRL+C, rather than it being interpreted as an interrupt key. ,这将允许您处理CTRL + C的任何用户键序列,而不是将其解释为中断键。

They tend to all be different. 他们往往都不同。 In Windows 10 CMD you can go to properties and unselect "enable ctrl key shortcuts." 在Windows 10 CMD中,您可以转到属性,然后取消选择“启用ctrl键快捷方式”。

You can't, however, disable all Windows ctrl key shortcuts. 但是,您不能禁用所有Windows Ctrl键快捷键。 At least that I'm aware of. 至少我知道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM