gpt4 book ai didi

c# - 在整个应用程序中捕获按键

转载 作者:太空狗 更新时间:2023-10-29 21:09:39 26 4
gpt4 key购买 nike

是否有可能捕获(我猜是在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com