Home > OS >  Is there a way to detect a side mouse button press in c#?
Is there a way to detect a side mouse button press in c#?

Time:06-05

Is there a way to detect a side mouse button press in c# (For example, Mouse 5)?

without using any external libraries would be the best method, but it wont be the end of the world.

CodePudding user response:

Create on any control event method MouseDown. Second method arguments in this method will be MouseButtonEventArgs which has property ChangedButton.

ChangedButton is a mouse button that was pressed.

In your case side button 5 will be XButton2.

https://docs.microsoft.com/en-us/dotnet/api/system.windows.input.mousebutton?view=windowsdesktop-6.0

  • Related