Mouse.SetCursor Method (Cursor)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Sets the mouse pointer to the specified Cursor.

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

static member SetCursor : 
        cursor:Cursor -> bool

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
Available since 3.0
Return to top
Show: