Skip to content

Mouse Class

The state of the mouse.

C#
public class Mouse

Inheritance object

C#
public Mouse()

The pixel position of the mouse on the screen.

C#
public Point ScreenPosition { get; set; }

Indicates the middle mouse button is currently being pressed.

C#
public bool MiddleButtonDown { get; set; }

The amount of time the middle button has been held down.

C#
public TimeSpan MiddleButtonDownDuration { get; }

Indicates the middle mouse button was clicked. (Held and then released)

C#
public bool MiddleClicked { get; set; }

Indicates the middle mouse button was double-clicked within one second.

C#
public bool MiddleDoubleClicked { get; set; }

Indicates the left mouse button is currently being pressed.

C#
public bool LeftButtonDown { get; set; }

The amount of time the left button has been held down.

C#
public TimeSpan LeftButtonDownDuration { get; }

Indicates the left mouse button was clicked. (Held and then released)

C#
public bool LeftClicked { get; set; }

Indicates the left mouse button was double-clicked within one second.

C#
public bool LeftDoubleClicked { get; set; }

Indicates the right mouse button is currently being pressed.

C#
public bool RightButtonDown { get; set; }

The amount of time the right button has been held down.

C#
public TimeSpan RightButtonDownDuration { get; }

Indicates the right mouse button was clicked. (Held and then released)

C#
public bool RightClicked { get; set; }

Indicates the right mouse button was double-clicked within one second.

C#
public bool RightDoubleClicked { get; set; }

The cumulative value of the scroll wheel.

C#
public int ScrollWheelValue { get; set; }

The scroll wheel value change between frames.

C#
public int ScrollWheelValueChange { get; set; }

Indicates that the mouse is currently within the bounds of the rendering area.

C#
public bool IsOnScreen { get; }

Reads the mouse state from GetMouseState().

C#
public void Update(TimeSpan elapsedSeconds)

elapsedSeconds TimeSpan
Fractional seconds passed since Update was called.

Clears the buttons, position, wheel information.

C#
public void Clear()

Builds information about the mouse state based on the FocusedScreenObjects or Screen. Should be called each frame.

C#
public virtual void Process()

Unlocks the last screen object the mouse was locked to. Allows another console to become locked to the mouse.

C#
public void ClearLastMouseScreenObject()

IsMouseOverScreenObjectSurface(IScreenSurface)

Section titled “IsMouseOverScreenObjectSurface(IScreenSurface)”

Returns true when the mouse is currently over the provided screen object.

C#
public bool IsMouseOverScreenObjectSurface(IScreenSurface screenObject)

screenObject IScreenSurface
The screen object to check.

bool
True or false indicating if the mouse is over the screen object.

Clones this mouse into a new object.

C#
public Mouse Clone()

Mouse
A clone.