Show / Hide Table of Contents

Class MouseDevice

Represents a mouse device and provides methods to query its status.

Inheritance
Object
MouseDevice
Implements
IInputDevice
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Namespace: OpenTK.Input
Assembly: OpenTK.dll
Syntax
public sealed class MouseDevice : IInputDevice

Properties

Description

Gets a string describing this MouseDevice.

Declaration
public string Description { get; }
Property Value
Type Description
String

DeviceID

Gets an IntPtr representing a device dependent ID.

Declaration
public IntPtr DeviceID { get; }
Property Value
Type Description
IntPtr

DeviceType

Gets a value indicating the InputDeviceType of this InputDevice.

Declaration
public InputDeviceType DeviceType { get; }
Property Value
Type Description
InputDeviceType

Item[MouseButton]

Gets a System.Boolean indicating the state of the specified MouseButton.

Declaration
public bool this[MouseButton button] { get; }
Parameters
Type Name Description
MouseButton button

The MouseButton to check.

Property Value
Type Description
Boolean

True if the MouseButton is pressed, false otherwise.

NumberOfButtons

Gets an integer representing the number of buttons on this MouseDevice.

Declaration
public int NumberOfButtons { get; }
Property Value
Type Description
Int32

NumberOfWheels

Gets an integer representing the number of wheels on this MouseDevice.

Declaration
public int NumberOfWheels { get; }
Property Value
Type Description
Int32

Wheel

Gets the absolute wheel position in integer units. To support high-precision mice, it is recommended to use WheelPrecise instead.

Declaration
public int Wheel { get; }
Property Value
Type Description
Int32

WheelPrecise

Gets the absolute wheel position in floating-point units.

Declaration
public float WheelPrecise { get; }
Property Value
Type Description
Single

X

Gets an integer representing the absolute x position of the pointer, in window pixel coordinates.

Declaration
public int X { get; }
Property Value
Type Description
Int32

Y

Gets an integer representing the absolute y position of the pointer, in window pixel coordinates.

Declaration
public int Y { get; }
Property Value
Type Description
Int32

Methods

GetCursorState()

Retreves the MouseState for the mouse cursor. This method is equivalent to GetCursorState().

Declaration
public MouseState GetCursorState()
Returns
Type Description
MouseState

A MouseState structure representing the state of the mouse cursor.

See Also
GetCursorState()

GetHashCode()

Calculates the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
Overrides
Object.GetHashCode()

GetState()

Retrieves the combined hardware MouseState for all specified mouse devices. This method is equivalent to GetState().

Declaration
public MouseState GetState()
Returns
Type Description
MouseState

A MouseState structure representing the state for the specified mouse device.

See Also
GetState()

GetState(Int32)

Retrieves the hardware MouseState for the specified mouse device. This method is equivalent to GetState(Int32).

Declaration
public MouseState GetState(int index)
Parameters
Type Name Description
Int32 index

The index of the mouse device.

Returns
Type Description
MouseState

A MouseState structure representing the state for the specified mouse device.

See Also
GetState(Int32)

ToString()

Returns a String that describes this instance.

Declaration
public override string ToString()
Returns
Type Description
String

A String that describes this instance.

Overrides
Object.ToString()

Events

ButtonDown

Occurs when a button is pressed.

Declaration
public event EventHandler<MouseButtonEventArgs> ButtonDown
Event Type
Type Description
EventHandler<MouseButtonEventArgs>

ButtonUp

Occurs when a button is released.

Declaration
public event EventHandler<MouseButtonEventArgs> ButtonUp
Event Type
Type Description
EventHandler<MouseButtonEventArgs>

Move

Occurs when the mouse's position is moved.

Declaration
public event EventHandler<MouseMoveEventArgs> Move
Event Type
Type Description
EventHandler<MouseMoveEventArgs>

WheelChanged

Occurs when one of the mouse wheels is moved.

Declaration
public event EventHandler<MouseWheelEventArgs> WheelChanged
Event Type
Type Description
EventHandler<MouseWheelEventArgs>

Implements

IInputDevice
In This Article
Back to top Generated by DocFX