Mouse.OverrideCursor Propiedad

Definición

Obtiene o establece el cursor en toda la aplicación.

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; }
static member 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.

Ejemplos

En el ejemplo siguiente se muestra un controlador de eventos para un RadioButton objeto que se usa para alternar el ámbito de un cambio de cursor entre un único elemento y toda la aplicación. Si el control que generó el evento es rbScopeElementRadioButton, se establece una marca que denota el ámbito del cambio del cursor y OverrideCursor se establece nullen . Si el control que generó el evento es rbScopeApplicationRadioButton, se establece una marca que denota el ámbito del cambio del cursor y OverrideCursor se establece en la Cursor propiedad del Border control denominado 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

Que CursorOverrideCursor se establece en se aplicará a toda la aplicación.

Para borrar la invalidación Cursor, establezca en OverrideCursornull.

Si se establece OverrideCursor en None , se forzará que el cursor del mouse no se muestre, pero los eventos del mouse se siguen procesando.

Se aplica a