Mouse.OverrideCursor Eigenschap

Definitie

Hiermee haalt u de cursor voor de hele toepassing op of stelt u deze in.

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

Waarde van eigenschap

De overschrijfcursor of null als de OverrideCursor cursor niet is ingesteld.

Voorbeelden

In het volgende voorbeeld ziet u een gebeurtenis-handler voor een RadioButton gebeurtenis die wordt gebruikt om het bereik van een cursorwijziging tussen één element en de hele toepassing in te schakelen. Als het besturingselement dat de gebeurtenis heeft gegenereerd de rbScopeElementRadioButtonvlag is, wordt het bereik van de cursorwijziging ingesteld en OverrideCursor ingesteld nullop . Als het besturingselement dat de gebeurtenis heeft gegenereerd de rbScopeApplicationRadioButtonvlag is, wordt het bereik van de cursorwijziging ingesteld en OverrideCursor ingesteld op de eigenschap van het besturingselement met de CursorBorder naamDisplayArea.

// 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

Opmerkingen

De Cursor instelling OverrideCursor die is ingesteld, wordt toegepast op de hele toepassing.

Als u de onderdrukking Cursorwilt wissen, stelt u in op OverrideCursornull.

Als u deze instelling OverrideCursor instelt None , wordt de muiscursor niet weergegeven, maar worden de muisgebeurtenissen nog steeds verwerkt.

Van toepassing op