Skip to main content

Mouse Class

NuGet: GHIElectronics.TinyCLR.Devices.UsbClient
Assembly: GHIElectronics.TinyCLR.Devices.UsbClient
Namespace: GHIElectronics.TinyCLR.Devices.UsbClient

This device emulates a mouse. You can move the cursor, scroll the wheel, and press buttons.

public class Mouse : RawDevice

Constructors​

Mouse(UsbClientController usbClientController, bool absolutePositon)​

public Mouse(UsbClientController usbClientController, bool absolutePositon = false) : this(usbClientController, new UsbClientSetting()

Creates a new mouse.

ParameterTypeDescription
usbClientControllerUsbClientControllerUsbClient controller.
absolutePositonbooltrue for absolute position, false for relative

Mouse(UsbClientController usbClientController, UsbClientSetting usbClientSetting, bool absolutePositon)​

public Mouse(UsbClientController usbClientController, UsbClientSetting usbClientSetting, bool absolutePositon = false) : base(usbClientController, usbClientSetting)

Creates a new mouse.

ParameterTypeDescription
usbClientControllerUsbClientControllerUsbClient controller.
usbClientSettingUsbClientSettingUsbClient setting
absolutePositonbooltrue for absolute position, false for relative

Properties​

MaxRange​

public static int MaxRange { get; }

The maximum range for movement.

MinRange​

public static int MinRange { get; }

The minimum range for movement.

ClickButtonDelay​

public int ClickButtonDelay { get; set; }

The mouse click delay in millisecond.

AbsolutePosition​

public bool AbsolutePosition { get; set; }

Return true for absolute, false for relative mode.

Methods​

IsPressedButton(Buttons button)​

public bool IsPressedButton(Buttons button)

Whether or not the given button is pressed.

ParameterTypeDescription
buttonButtonsThe button to check.

Returns bool — If it is pressed or not.

PressButton(Buttons button)​

public void PressButton(Buttons button)

Presses the given button.

ParameterTypeDescription
buttonButtonsThe button to press.

ReleaseButton(Buttons button)​

public void ReleaseButton(Buttons button)

Releases the given button.

ParameterTypeDescription
buttonButtonsThe button to release.

Click(Buttons button)​

public void Click(Buttons button)

Presses then releases the given button with the given delay between the actions.

ParameterTypeDescription
buttonButtonsThe button to click.

MoveWheel(int position)​

public void MoveWheel(int position)

Moves the wheel to the given position.

ParameterTypeDescription
positionintThe new position.

MoveCursor(int x, int y)​

public void MoveCursor(int x, int y)

Moves the cursor's x and y coordinate to the given position.

ParameterTypeDescription
xintThe new x position.
yintThe new p position.