Class Mouse
Provides static methods, properties, and events for interacting with the mouse, including retrieving button states, mouse position, and handling mouse-related events.
public static class Mouse
- Inheritance
-
Mouse
Remarks
The Mouse class offers a centralized way to interact with mouse input in an application. It includes functionality to determine the state of mouse buttons, retrieve the current mouse position, and handle mouse movement events. The class also provides access to the underlying mouse handler through the Handler property, which can be customized as needed. This class is designed to support advanced scenarios, such as handling finer-resolution mouse wheels or calculating positions relative to specific controls. It is thread-safe for read operations, but care should be taken when modifying the Handler property in a multithreaded environment.
Fields
- MouseWheelDeltaForOneLine
The number of units the mouse wheel should be rotated to scroll one line.
Properties
- Handler
Gets or sets IMouseHandler used to access mouse.
- IsMousePresent
Gets whether mouse is present.
- LeftButton
The state of the left button.
- MiddleButton
The state of the middle button.
- RightButton
The state of the right button.
- XButton1
The state of the first extended button.
- XButton2
The state of the second extended button.
Methods
- CoercePosition(PointD?, AbstractControl?)
Determines the effective position based on the specified position and the relative control.
- GetButtonState(MouseButton)
Gets mouse button state.
- GetPosition(AbstractControl?)
Calculates the position of the mouse relative to a particular element.
- GetPosition(float)
Gets mouse button position.
- RaiseMoved(object, MouseEventArgs)
Raises Moved event.
Events
- Moved
Occurs when any of the controls receives mouse move event.