Mouse.OverrideCursor Proprietà

Definizione

Ottiene o imposta il cursore per l'intera applicazione.

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

Valore della proprietà

Cursore di override o null se OverrideCursor non è impostato.

Esempio

Nell'esempio seguente viene illustrato un gestore eventi per un RadioButton oggetto utilizzato per attivare o disattivare l'ambito di una modifica del cursore tra un singolo elemento e l'intera applicazione. Se il controllo che ha generato l'evento è rbScopeElementRadioButton, viene impostato un flag che indica l'ambito della modifica del cursore e OverrideCursor viene impostato su null. Se il controllo che ha generato l'evento è rbScopeApplicationRadioButton, viene impostato un flag che indica l'ambito della modifica del cursore e OverrideCursor viene impostato sulla Cursor proprietà del Border controllo denominato 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

Commenti

OverrideCursor L'oggetto Cursor impostato su verrà applicato all'intera applicazione.

Per cancellare l'override Cursor, impostare su OverrideCursornull.

Se si imposta OverrideCursor su None , il cursore del mouse non verrà visualizzato, ma gli eventi del mouse vengono comunque elaborati.

Si applica a