Export (0) Print
Expand All

Mouse Class

Represents the mouse device to a specific thread.

System.Object
  System.Windows.Input.Mouse

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public static class Mouse

The Mouse type exposes the following members.

  NameDescription
Public propertyStatic memberCapturedGets the element that has captured the mouse.
Public propertyStatic memberDirectlyOverGets the element the mouse pointer is directly over.
Public propertyStatic memberLeftButtonGets the state of the left button of the mouse.
Public propertyStatic memberMiddleButton Gets the state of the middle button of the mouse.
Public propertyStatic memberOverrideCursorGets or sets the cursor for the entire application.
Public propertyStatic memberPrimaryDeviceGets the primary mouse device.
Public propertyStatic memberRightButton Gets the state of the right button.
Public propertyStatic memberXButton1 Gets the state of the first extended button.
Public propertyStatic memberXButton2Gets the state of the second extended button.
Top

  NameDescription
Public methodStatic memberAddGotMouseCaptureHandlerAdds a handler for the GotMouseCapture attached event.
Public methodStatic memberAddLostMouseCaptureHandlerAdds a handler for the LostMouseCapture attached event.
Public methodStatic memberAddMouseDownHandlerAdds a handler for the MouseDown attached event.
Public methodStatic memberAddMouseEnterHandlerAdds a handler for the MouseEnter attached event.
Public methodStatic memberAddMouseLeaveHandlerAdds a handler for the MouseLeave attached event.
Public methodStatic memberAddMouseMoveHandlerAdds a handler for the MouseMove attached event.
Public methodStatic memberAddMouseUpHandlerAdds a handler for the MouseUp attached event.
Public methodStatic memberAddMouseWheelHandlerAdds a handler for the MouseWheel attached event.
Public methodStatic memberAddPreviewMouseDownHandlerAdds a handler for the PreviewMouseDown attached event.
Public methodStatic memberAddPreviewMouseDownOutsideCapturedElementHandlerAdds a handler for the PreviewMouseDownOutsideCapturedElement attached event.
Public methodStatic memberAddPreviewMouseMoveHandlerAdds a handler for the PreviewMouseMove attached event.
Public methodStatic memberAddPreviewMouseUpHandlerAdds a handler for the PreviewMouseUp attached event.
Public methodStatic memberAddPreviewMouseUpOutsideCapturedElementHandlerAdds a handler for the PreviewMouseUpOutsideCapturedElement attached event.
Public methodStatic memberAddPreviewMouseWheelHandlerAdds a handler for the PreviewMouseWheel attached event.
Public methodStatic memberAddQueryCursorHandlerAdds a handler for the QueryCursor attached event.
Public methodStatic memberCapture(IInputElement)Captures mouse input to the specified element.
Public methodStatic memberCapture(IInputElement, CaptureMode)Captures mouse input to the specified element using the specified CaptureMode.
Public methodStatic memberGetIntermediatePointsRetrieves up to 64 previous coordinates of the mouse pointer since the last mouse move event.
Public methodStatic memberGetPositionGets the position of the mouse relative to a specified element.
Public methodStatic memberRemoveGotMouseCaptureHandlerRemoves a handler for the GotMouseCapture attached event.
Public methodStatic memberRemoveLostMouseCaptureHandlerRemoves a handler for the LostMouseCapture attached event.
Public methodStatic memberRemoveMouseDownHandlerRemoves a handler for the MouseDown attached event.
Public methodStatic memberRemoveMouseEnterHandlerRemoves a handler for the MouseEnter attached event.
Public methodStatic memberRemoveMouseLeaveHandlerRemoves a handler for the MouseLeave attached event.
Public methodStatic memberRemoveMouseMoveHandlerRemoves a handler for the MouseMove attached event.
Public methodStatic memberRemoveMouseUpHandlerRemoves a handler for the MouseUp attached event.
Public methodStatic memberRemoveMouseWheelHandlerRemoves a handler for the MouseWheel attached event.
Public methodStatic memberRemovePreviewMouseDownHandlerRemoves a handler for the PreviewMouseDown attached event.
Public methodStatic memberRemovePreviewMouseDownOutsideCapturedElementHandlerRemoves a handler for the PreviewMouseDownOutsideCapturedElement attached event.
Public methodStatic memberRemovePreviewMouseMoveHandlerRemoves a handler for the PreviewMouseMove attached event.
Public methodStatic memberRemovePreviewMouseUpHandlerRemoves a handler for the PreviewMouseUp attached event.
Public methodStatic memberRemovePreviewMouseUpOutsideCapturedElementHandlerRemoves a handler for the PreviewMouseUpOutsideCapturedElement attached event.
Public methodStatic memberRemovePreviewMouseWheelHandlerRemoves a handler for the PreviewMouseWheel attached event.
Public methodStatic memberRemoveQueryCursorHandlerRemoves a handler for the QueryCursor attached event.
Public methodStatic memberSetCursorSets the mouse pointer to the specified Cursor.
Public methodStatic memberSynchronizeForces the mouse to resynchronize.
Public methodStatic memberUpdateCursor Forces the mouse cursor to be updated.
Top

  NameDescription
Public attached eventGotMouseCaptureOccurs when an element captures the mouse.
Public attached eventLostMouseCaptureOccurs when an element loses mouse capture.
Public attached eventMouseDownOccurs when any mouse button is depressed.
Public attached eventMouseEnterOccurs when the mouse pointer enters the boundaries of an element.
Public attached eventMouseLeaveOccurs when the mouse pointer leaves the boundaries of an element.
Public attached eventMouseMoveOccurs when the mouse pointer moves.
Public attached eventMouseUpOccurs when any mouse button is released.
Public attached eventMouseWheelOccurs when the mouse wheel is rotated.
Public attached eventPreviewMouseDown Occurs when any mouse button is depressed.
Public attached eventPreviewMouseDownOutsideCapturedElementOccurs when the primary mouse button is pressed outside the element that is capturing mouse events.
Public attached eventPreviewMouseMoveOccurs when the mouse moves over an element.
Public attached eventPreviewMouseUp Occurs when any mouse button is released.
Public attached eventPreviewMouseUpOutsideCapturedElementOccurs when the primary mouse button is released outside the element that is capturing mouse events.
Public attached eventPreviewMouseWheel Occurs when the mouse wheel rotates.
Public attached eventQueryCursorOccurs when an element queries for the current mouse cursor.
Top

  NameDescription
Public fieldStatic memberGotMouseCaptureEventIdentifies the GotMouseCapture attached event.
Public fieldStatic memberLostMouseCaptureEventIdentifies the LostMouseCapture attached event.
Public fieldStatic memberMouseDownEventIdentifies the MouseDown attached event.
Public fieldStatic memberMouseEnterEventIdentifies the MouseEnter attached event.
Public fieldStatic memberMouseLeaveEventIdentifies the MouseLeave attached event.
Public fieldStatic memberMouseMoveEventIdentifies the MouseMove attached event.
Public fieldStatic memberMouseUpEventIdentifies the MouseUp attached event.
Public fieldStatic memberMouseWheelDeltaForOneLineRepresents the number of units the mouse wheel is rotated to scroll one line.
Public fieldStatic memberMouseWheelEventIdentifies the MouseWheel attached event.
Public fieldStatic memberPreviewMouseDownEventIdentifies the PreviewMouseDown attached event.
Public fieldStatic memberPreviewMouseDownOutsideCapturedElementEventIdentifies the PreviewMouseDownOutsideCapturedElement attached event.
Public fieldStatic memberPreviewMouseMoveEventIdentifies the PreviewMouseMove attached event.
Public fieldStatic memberPreviewMouseUpEventIdentifies the PreviewMouseUp attached event.
Public fieldStatic memberPreviewMouseUpOutsideCapturedElementEventIdentifies the PreviewMouseUpOutsideCapturedElement attached event.
Public fieldStatic memberPreviewMouseWheelEventIdentifies the PreviewMouseWheel attached event.
Public fieldStatic memberQueryCursorEventIdentifies the QueryCursor attached event.
Top

The Mouse class provides mouse related events, methods and, properties which provide information regarding the state of the mouse.

Each event that Mouse defines as an attached event is also re-exposed by the base element classes UIElement and ContentElement as a new routed event. Generally, it is more convenient to handle mouse events for an application on UIElement and ContentElement, rather than using the Mouse events. For details, see Input Overview.

The static members of the Mouse class delegate to the primary MouseDevice of the calling thread's input manager.

.NET Framework

Supported in: 4.6, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft