是否有可能捕获(我猜是在 app.xaml.cs 中的某处)任何键以及它是否按下了打开的窗口?
感谢您的帮助!
最佳答案
有更好的方法。找到this在 MS 论坛上。就像一个魅力。
将此代码放在应用程序启动中:
EventManager.RegisterClassHandler(typeof(Window),
Keyboard.KeyUpEvent,new KeyEventHandler(keyUp), true);
private void keyUp(object sender, KeyEventArgs e)
{
//Your code...
}
关于c# - 在整个应用程序中捕获按键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13958142/