none
How to differentiate scrolling (up and down) and middle key left/right click with MouseEventArgs? RRS feed

  • Question

  • I always get the same value by a method. I tried them all (Location, Button, Delta, getHashCode, getType etc.). The return values don't differentiate if i scroll or if i left/right click the mouse wheel (Logitech RX250). Is there a way or do i have to use another class, which one?
    • Moved by CoolDadTx Friday, July 31, 2020 1:43 PM Winforms related
    Friday, July 31, 2020 12:31 PM

Answers

  • I found the solution by wparam. By the Delta property i can differentiate if it's up, down, left or right.

    Thanks for your help.

    • Marked as answer by ILT5000 Saturday, August 1, 2020 8:15 PM
    Saturday, August 1, 2020 7:20 PM

All replies

  • The button that was clicked is determined by the Button property. It indicates LMR and a couple extras. Note that not all mice support mouse wheel clicks. In many cases software won't recognize it but some software allows you to map the mouse wheel click to another button. In this case your app wouldn't be able to tell the difference.

    The Delta property determines how many times the wheel was rotated forward or back. It can be positive or negative depending upon whether it was rotated forward or back. Note that how many times this value is incremented depends upon settings so use positive/negative to determine direction.

    If you're having an issue with a specific mouse then try a different one instead. If the problem persists then the issue is with your code otherwise it is differences in the mice you're using. Mouse profile software from the manufacturer can often override this behavior so also be aware of that.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, July 31, 2020 1:43 PM
  • I found the solution by wparam. By the Delta property i can differentiate if it's up, down, left or right.

    Thanks for your help.

    • Marked as answer by ILT5000 Saturday, August 1, 2020 8:15 PM
    Saturday, August 1, 2020 7:20 PM