Mouse.OverrideCursor Propriedade

Definição

Obtém ou define o cursor para o aplicativo inteiro.

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 da propriedade

O cursor de substituição ou null se o OverrideCursor não está definido.

Exemplos

O exemplo a seguir mostra um manipulador de eventos para um RadioButton que é usado para alternar o escopo de uma alteração de cursor entre um único elemento e todo o aplicativo. Se o controle que acionou o evento for o rbScopeElementRadioButton, um sinalizador que indica o escopo da alteração do cursor será definido e OverrideCursor será definido nullcomo . Se o controle que acionou o evento for o rbScopeApplicationRadioButton, um sinalizador que indica o escopo da alteração do cursor será definido e OverrideCursor será definido como a Cursor propriedade do Border controle chamado 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

Comentários

O Cursor definido OverrideCursor como será aplicado a todo o aplicativo.

Para limpar a substituição Cursor, defina OverrideCursor como null.

A configuração OverrideCursor como None forçará o cursor do mouse a não ser exibido, mas os eventos do mouse ainda serão processados.

Aplica-se a