Mouse.OverrideCursor Mouse.OverrideCursor Mouse.OverrideCursor Mouse.OverrideCursor Property

Definición

Obtiene o establece el cursor en toda la aplicación.Gets or sets the cursor for the entire application.

public:
 static property System::Windows::Input::Cursor ^ OverrideCursor { System::Windows::Input::Cursor ^ get(); void set(System::Windows::Input::Cursor ^ value); };
public static System.Windows.Input.Cursor OverrideCursor { get; set; }
member this.OverrideCursor : System.Windows.Input.Cursor with get, set
Public Shared Property OverrideCursor As Cursor

Valor de propiedad

Cursor de invalidación o null si no se establece OverrideCursor.The override cursor or null if the OverrideCursor is not set.

Ejemplos

En el ejemplo siguiente se muestra un controlador de RadioButton eventos para un que se utiliza para alternar el ámbito de un cambio de cursor entre un solo elemento y toda la aplicación.The following example shows an event handler for a RadioButton that is used to toggle the scope of a cursor change between a single element and the entire application. Si el control que provocó el evento es rbScopeElement RadioButton, se establece una marca que denota el ámbito del cambio de cursor y OverrideCursor se establece en null.If the control that raised the event is the rbScopeElementRadioButton, a flag that denotes the scope of the cursor change is set and OverrideCursor is set to null. Si el control que provocó el evento es rbScopeApplication RadioButton, se establece una marca que denota el ámbito del cambio de cursor y OverrideCursor se establece en la Cursor propiedad del Border control denominado DisplayArea.If the control that raised the event is the rbScopeApplicationRadioButton, a flag that denotes the scope of the cursor change is set and OverrideCursor is set to the Cursor property of the Border control named DisplayArea.

// Determines the scope the new cursor will have.
//
// If the RadioButton rbScopeElement is selected, then the cursor
// will only change on the display element.
// 
// If the Radiobutton rbScopeApplication is selected, then the cursor
// will be changed for the entire application
//
private void CursorScopeSelected(object sender, RoutedEventArgs e)
{
    RadioButton source = e.Source as RadioButton;

    if (source != null)
    {
        if (source.Name == "rbScopeElement")
        {
            // Setting the element only scope flag to true
            cursorScopeElementOnly = true;

            // Clearing out the OverrideCursor.  
            Mouse.OverrideCursor = null;

        }
        if (source.Name == "rbScopeApplication")
        {
           // Setting the element only scope flag to false
           cursorScopeElementOnly = false;

           // Forcing the cursor for all elements. 
           Mouse.OverrideCursor = DisplayArea.Cursor;
        }
    }
}
' Determines the scope the new cursor will have.
'
' If the RadioButton rbScopeElement is selected, then the cursor
' will only change on the display element.
' 
' If the Radiobutton rbScopeApplication is selected, then the cursor
' will be changed for the entire application.
'
Private Sub CursorScopeSelected(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim source As RadioButton = CType(e.Source, RadioButton)

    If (source.Name = "rbScopeElement") Then
        ' Setting the element only scope flag to true.
        cursorScopeElementOnly = True
        ' Clearing out the OverrideCursor.
        Mouse.OverrideCursor = Nothing

    End If
    If (source.Name = "rbScopeApplication") Then
        ' Setting the element only scope flag to false.
        cursorScopeElementOnly = False
        ' Forcing the cursor for all elements.
        Mouse.OverrideCursor = DisplayArea.Cursor
    End If
End Sub

Comentarios

Cursor QueOverrideCursor se establece en se aplicará a toda la aplicación.The Cursor that OverrideCursor is set to will be applied to the whole application.

Para borrar la invalidación Cursor, establezca null OverrideCursor en.To clear the override Cursor, set OverrideCursor to null.

Si OverrideCursor se None establece en, se forzará la visualización del cursor del mouse, pero se siguen procesando los eventos del mouse.Setting OverrideCursor to None will force the mouse cursor not to be displayed, but mouse events are still processed.

Se aplica a