简体   繁体   中英

“Ctrl + C” buttons pressed handle C# console app

如何处理同时按下的两个按钮('Ctrl'+'C'),而不是在WindowsForms应用程序中,而是在控制台C#应用程序中?

I suspect you want to set Console.TreatCtrlCAsInput to true . (Assuming you don't want this to terminate the app.)

Check out Console.TreatControlCAsInput property;

Gets or sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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