#656 – Data Available to Mouse Button Event Handlers

The various mouse button events that fire when a mouse button is pressed or released all provide data to the event handler as part of a MouseButtonEventArgs object.  The information contained in this object and available to button press event handlers is listed below.

  • LeftButton – Current state of left button (Released | Pressed)
  • MiddleButton – Current state of middle button (Released | Pressed)
  • RightButton – Current state of right button (Released | Pressed)
  • ButtonState – Current state of whichever button triggered the event (Released | Pressed)
  • ChangedButton – Which button triggered the event?  (Left | Middle | Right | XButton1 | XButton2)
  • ClickCount – # of times button was clicked (events will fire multiple times)
  • MouseDevice – Access to a MouseDevice object, which allows getting general information about the mouse position or mouse buttons
Advertisement