简体   繁体   English

全局热键分配窗口

[英]global Hotkey assignment windows

I've built a WPF app that has a main window 我已经构建了一个具有主窗口的WPF应用

I want to press Ctr+Alt+1 to activate / maximize the window 我想按Ctr + Alt + 1激活/最大化窗口

I then have on the window a 9 tabbed panel 然后在窗口上有一个9标签式面板

I want to access each tab with hotkey presses with 1-9 respectively (when the main window is active), when the window isnt active and maximized I want to remove the hotkeys 我想分别用热键1-9来访问每个选项卡(当主窗口处于活动状态时),当窗口处于非活动状态且最大化时,我想删除热键

On each tab I have 9 buttons, I want to be able to then activate the button click with hotkeys 1-9 again when the tab is in focus. 在每个选项卡上,我有9个按钮,我希望能够在焦点对准该选项卡时再次使用热键1-9激活按钮单击。

I've found an article http://www.codeproject.com/Articles/160441/Using-C-Interfaces-to-Make-Applications-Resilient which gives a nice way to generate the hotkeys with a class but I am getting in aa real mess trying to implement this functionality. 我发现了一篇文章http://www.codeproject.com/Articles/160441/Using-C-Interfaces-to-Make-Applications-Resilient ,它提供了一种很好的方法来生成带有类的热键,但是我正在进入一个真正的混乱,试图实现此功能。

What should I do? 我该怎么办? (I dont want to use Autohotkey btw) (我不想使用Autohotkey btw)

Is there a better way to achieve this rather than the link above? 有没有比上面的链接更好的方法来实现这一目标?

There is no other way to create global hotkeys without pinvoke from WinApi as far as I know. 据我所知,没有其他方法可以创建没有WinApi的pinvoke的全局热键。 Check this for wpf: http://outcoldman.com/en/blog/show/240 检查此WPF: http : //outcoldman.com/en/blog/show/240

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

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