Mouse.OverrideCursor 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
전체 애플리케이션에 대한 커서를 가져오거나 설정합니다.
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
속성 값
재정의 커서이거나 OverrideCursor 설정되지 않은 경우 null
.
예제
다음 예제에서는 단일 요소와 전체 애플리케이션 간의 커서 변경 범위를 토글하는 데 사용되는 RadioButton 대한 이벤트 처리기를 보여 줍니다. 이벤트를 발생시킨 컨트롤이 rbScopeElement
RadioButton경우 커서 변경의 범위를 나타내는 플래그가 설정되고 OverrideCursornull
. 이벤트를 발생시킨 컨트롤이 rbScopeApplication
RadioButton경우 커서 변경 범위를 나타내는 플래그가 설정되고 OverrideCursorDisplayArea
명명된 Border 컨트롤의 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 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
설명
OverrideCursor 설정된 Cursor 전체 애플리케이션에 적용됩니다.
재정의 Cursor지우려면 OverrideCursornull
설정합니다.
OverrideCursor None 설정하면 마우스 커서가 표시되지 않지만 마우스 이벤트는 여전히 처리됩니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기