MouseEventArgs

EventArgsReferences
public class MouseEventArgs : EventArgs
Mouse event arguments.

Constructors

MouseEventArgs

#
public MouseEventArgs(MouseButtons buttons, Keys modifiers, PointF location, SizeF? delta = null, float pressure = 1)
Initializes a new instance of the MouseEventArgs class.
buttons (MouseButtons)Buttons involved in the event.
modifiers (Keys)Key modifiers such as Control, Alt, or Shift.
location (PointF)Location of the mouse cursor for the event.
delta (SizeF? = null)Delta of the scroll wheel.
pressure (float = 1)Pressure of a stylus or touch, if applicable. 1.0f for full pressure or not supported

MouseEventArgs

#Since v2.12
public MouseEventArgs(MouseButtons buttons, Keys modifiers, PointF location, SizeF? delta, float pressure, bool isDirectionInverted)
Initializes a new instance of the MouseEventArgs class.
buttons (MouseButtons)Buttons involved in the event.
modifiers (Keys)Key modifiers such as Control, Alt, or Shift.
location (PointF)Location of the mouse cursor for the event.
delta (SizeF?)Delta of the scroll wheel.
pressure (float)Pressure of a stylus or touch, if applicable. 1.0f for full pressure or not supported
isDirectionInverted (bool)Whether the delta is inverted from the direction of the physical device.

Properties

Buttons

#
public MouseButtons Buttons { get; }
Gets the mouse buttons involved in the event.

Delta

#
public SizeF Delta { get; }
Gets or sets the delta change of the scroll wheel for the event.

Handled

#
public bool Handled { get; set; }
Gets or sets a value indicating whether the event is handled.
Remarks: Set this to true if you perform logic with the event and wish the default event to be cancelled. Some platforms may cause audio feedback if the user's action does not perform anything.
true if handled; otherwise, false.

IsDirectionInverted

#Since v2.12
public bool IsDirectionInverted { get; }
Gets a value indicating that the Delta is inverted from the direction of the physical device.
Remarks:

This is true when the user has turned on natural (or reverse) scrolling for the device that generated the event, in which case the platform has already flipped the Delta so that the content follows the user's fingers. Use this when you need to move something with the device instead of with the content, such as panning a canvas with a two finger scroll.

Only wheel events report this, and only on platforms that expose the setting per event (currently macOS via NSEvent.isDirectionInvertedFromDevice). Elsewhere this is always false, as the platform gives no way to tell an inverted delta from a regular one.

true if the delta is inverted from the device; otherwise, false.

Location

#
public PointF Location { get; }
Gets the location of the mouse relative to the control that raised the event.

Pressure

#
public float Pressure { get; }
Gets or sets the pressure of the mouse/stylus press, if applicable. 1.0 if full pressure or not supported.