c# - WPF KeyPreview Windows Key and Second Key -
I am implementing a WPF application in C # 4.5 for Windows 7, and I was able to capture that event One user would like to be pressing Windows key and C
I have implemented the OnPreviewDownInvent and it is expected to fire (in my code I have some other events that close other key presses), although it only fire down the Windows key, and the other key I can not see the debug.Writeline by order.
Any idea how I capture both the windows key and C?
Private Zero onPreviewKeyDownEvent (Object Sender, KeyEventArgs E) {if ((e.Key == Key.C & amp; (Keyboard.Modifiers & ModifierKeys.Windows) = = ModifierKeys.Windows) & amp; amp; e.IsDown) Messagbox.Show ("Pressed1"); If (e.Key == Key.C & amp; (Keyboard.IsKeyDown (Key.LWin) || Keyboard.IsKeyDown (Key.RWin))) Messenger.Default.Send (New RightClickMessage ()) Messagbox. Show ("Pressed2"); System.Diagnostics.Debug.WriteLine (e.Key + "+ Keyboard. ISKDown (key.livin) +" ");} Thank you in advance for your help.
Here's how you win + c Private Zero OnPreviewKeyDownEvent (Object Sender, KeyEventArgs e) {Keyboard (Keyboard.IsKeyDown (Key.LWin)} can detect keyboards .Keydown (key.win) and keyboard. ISKDown (keyc)) / Win + C}} or
Private Zero onPreviewKeyDownEvent (Object Sender, KeyEventArgs e) {if ((Keyboard.GetKeyStates (Key.LW) In) & KeyStates.Down) == KeyStates.Down || (Keyboard.GetKeyStates (Key.RWin) & KeyStates.) == KeyStates.Down & amp; (Keyboard.GetKeyStates (Key) C.) & KeyStates.Down) == KeyStates.Down) {// Win + C}}
Comments
Post a Comment