Mouse.SetCursor Method

Sets the mouse pointer to the specified Cursor.

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

'Declaration
Public Shared Function SetCursor ( _
	cursor As Cursor _
) As Boolean

Parameters

cursor
Type: System.Windows.Input.Cursor

The cursor to set the mouse pointer to.

Return Value

Type: System.Boolean
true, if the cursor was set; otherwise, false.

The cursor being set does not apply to any particular element, but rather it applies to the whole application. So, if after setting the cursor the mouse pointer moves over an object which sets the cursor, the cursor will be changed again.

To force the mouse pointer to a specific Cursor and to force this Cursor on all elements, set the OverrideCursor property.

To set the cursor on a specific element, use the Cursor property on either FrameworkElement or FrameworkContentElement. For more information on the base elements, see the Base Elements Overview.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft