Mouse Class
Namespace: GHIElectronics.TinyCLR.Devices.UsbHost · Assembly: GHIElectronics.TinyCLR.Devices.UsbHost
Allows a usb device to be used a mouse.
public class Mouse : BaseDevice
Constructors
Mouse(uint id, byte interfaceIndex, bool absolutePosition)
public Mouse(uint id, byte interfaceIndex, bool absolutePosition = false) : base(id, interfaceIndex, DeviceType.Mouse)
Creates a new mouse.
| Parameter | Type | Description |
|---|---|---|
id | uint | The device id. |
interfaceIndex | byte | The device interface index. |
absolutePosition | bool |
Properties
LeftButtonState
public ButtonState LeftButtonState { get; }
The current state of the mouse's left button.
RightButtonState
public ButtonState RightButtonState { get; }
The current state of the mouse's right button.
MiddleButtonState
public ButtonState MiddleButtonState { get; }
The current state of the mouse's middle button.
Extended1ButtonState
public ButtonState Extended1ButtonState { get; }
The current state of the mouse's first extended button.
Extended2ButtonState
public ButtonState Extended2ButtonState { get; }
The current state of the mouse's second extended button.
CursorPosition
public Position CursorPosition { get; }
The current position of the cursor.
WheelPosition
public int WheelPosition { get; }
The current position of the mouse wheel.
AbsolutePosition
public bool AbsolutePosition { get; }
Return true for absolute, false for relative mode.
Methods
SetScale(float scale)
public void SetScale(float scale)
Scales the x, y, and wheel delta values.
| Parameter | Type | Description |
|---|---|---|
scale | float | The value by which to scale the data. |
SetCursorBounds(Position minimum, Position maximum)
public void SetCursorBounds(Position minimum, Position maximum)
Sets the cursor bounds.
| Parameter | Type | Description |
|---|---|---|
minimum | Position | The minimum bound. |
maximum | Position | The maximum bound. |
SetCursorPosition(Position newPosition)
public void SetCursorPosition(Position newPosition)
Sets the cursor position.
| Parameter | Type | Description |
|---|---|---|
newPosition | Position | The new position of the cursor. |
Dispose(bool disposing)
protected override void Dispose(bool disposing)
Disposes the mouse.
| Parameter | Type | Description |
|---|---|---|
disposing | bool | Whether or not this is called from Dispose. |
CheckEvents(object sender)
protected override void CheckEvents(object sender)
Repeatedly called with a period defined by WorkerInterval. Used to poll the device for data and raise any desired events.
| Parameter | Type | Description |
|---|---|---|
sender | object | Always null. |
Events
ButtonChanged
public event ButtonChangedEventHandler ButtonChanged
The event fired when one of the mouse's buttons is pressed or released.
WheelMoved
public event WheelMovedEventHandler WheelMoved
The event fired when the mouse's wheel has moved.
CursorMoved
public event CursorMovedEventHandler CursorMoved
The event fired when the mouse's cursor has moved.