简体   繁体   中英

How to detect which key is pressed when pointer wheel is changed using c# windows 8.1 app

I want to detect which Key is pressed when pointer wheel changed event is fire.I use this function to detect the key

  private void MyKeyDown(object sender, KeyRoutedEventArgs e)
{
    int keyValue = (int)e.Key;
    if ((keyValue >= 0x30 && keyValue <= 0x39) // numbers
     || (keyValue >= 0x41 && keyValue <= 0x5A) // letters
     || (keyValue >= 0x60 && keyValue <= 0x69)) // numpad
    {
        // do something
    }
}

but unable to use this with pointer wheel changed event.

You can store information on which key got a down event and not an up one. You could probably also use Window.Current.CoreWindow.GetKeyState() or GetAsyncKeyState() for simplicity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM