private void controlToHook_KeyUp(object sender, System.Windows.Forms.KeyEventArgs windowsKeyEvent) { KeyEventArgs aggKeyEvent = new KeyEventArgs((Keys)windowsKeyEvent.KeyData); widgetToSendTo.OnKeyUp(aggKeyEvent); Keyboard.SetKeyDownState(aggKeyEvent.KeyCode, false); windowsKeyEvent.Handled = aggKeyEvent.Handled; windowsKeyEvent.SuppressKeyPress = aggKeyEvent.SuppressKeyPress; }
private void ControlToHook_KeyUp(object sender, System.Windows.Forms.KeyEventArgs windowsKeyEvent) { // Only process the key up event if we were the ones to receive the key down event. // This is because the SaveFileDialog is returning us the key up event for enter after it closes. var aggKeyEvent = new KeyEventArgs((Keys)windowsKeyEvent.KeyData); if (Keyboard.IsKeyDown(aggKeyEvent.KeyCode)) { widgetToSendTo.OnKeyUp(aggKeyEvent); Keyboard.SetKeyDownState(aggKeyEvent.KeyCode, false); windowsKeyEvent.Handled = aggKeyEvent.Handled; windowsKeyEvent.SuppressKeyPress = aggKeyEvent.SuppressKeyPress; } }