Пример #1
0
        void form_KeyUp(object sender, KeyEventArgs e)
        {
            Keys key = e.KeyData & ~Keys.Shift;

            KeysReleased.Add(key);
            KeysDown.Remove(key);
        }
Пример #2
0
 public void Device_KeyboardInput(object sender, KeyboardInputEventArgs e)
 {
     if (e.State == KeyState.Pressed)
     {
         if (KeysDown.Contains(e.Key) == false)
         {
             KeysPressed.Add(e.Key);
             KeysDown.Add(e.Key);
         }
     }
     else if (e.State == KeyState.Released)
     {
         KeysReleased.Add(e.Key);
         KeysDown.Remove(e.Key);
     }
 }