/// <summary> /// Override the process command key method so that we can implement global keyboard /// shortcuts. /// </summary> /// <param name="msg">The windows message to process</param> /// <param name="keyData">The key to process</param> /// <returns>True if command key was processed.</returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (ShortcutKeyPressed != null && ShortcutKeys != null && ShortcutKeys.Contains(keyData)) { ShortcutKeyPressed.Invoke(this, new KeysArgs() { Keys = keyData }); return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
/// <summary> /// Override the process command key method so that we can implement global keyboard /// shortcuts. /// </summary> /// <param name="msg">The windows message to process</param> /// <param name="keyData">The key to process</param> /// <returns>True if command key was processed.</returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (ShortcutKeyPressed != null && ShortcutKeys != null) { KeysConverter kc = new KeysConverter(); string keyName = kc.ConvertToString(keyData); if (ShortcutKeys.Contains(keyName)) { ShortcutKeyPressed.Invoke(this, new KeysArgs() { Keys = keyData }); return(true); } } return(base.ProcessCmdKey(ref msg, keyData)); }