Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

KeysExtensions.cs 773 B

8 mesi fa
12345678910111213141516171819202122
  1. // This code is distributed under MIT license.
  2. // Copyright (c) 2010-2018 George Mamaladze
  3. // See license.txt or https://mit-license.org/
  4. using System.Windows.Forms;
  5. namespace Gma.System.MouseKeyHook.Implementation
  6. {
  7. internal static class KeysExtensions
  8. {
  9. public static Keys Normalize(this Keys key)
  10. {
  11. if ((key & Keys.LControlKey) == Keys.LControlKey ||
  12. (key & Keys.RControlKey) == Keys.RControlKey) return Keys.Control;
  13. if ((key & Keys.LShiftKey) == Keys.LShiftKey ||
  14. (key & Keys.RShiftKey) == Keys.RShiftKey) return Keys.Shift;
  15. if ((key & Keys.LMenu) == Keys.LMenu ||
  16. (key & Keys.RMenu) == Keys.RMenu) return Keys.Alt;
  17. return key;
  18. }
  19. }
  20. }