CoreCursor 클래스

정의

커서(시각적 포인터) 개체를 정의합니다.

public ref class CoreCursor sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Core.ICoreCursorFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CoreCursor final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Core.ICoreCursorFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class CoreCursor final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Core.ICoreCursorFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class CoreCursor
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Core.ICoreCursorFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class CoreCursor
Public NotInheritable Class CoreCursor
상속
Object Platform::Object IInspectable CoreCursor
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

이 예제에서는 포인터가 단추 위에 있을 때 "손" 커서를 설정하는 방법을 보여 줍니다.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Button Content="Button 1"
            PointerEntered="Button_PointerEntered"
            PointerExited="Button_PointerExited"/>
</Grid>
public sealed partial class MainPage : Page
{
    CoreCursor buttonCursor = null;
    CoreCursor cursorBeforePointerEntered = null;

    public MainPage()
    {
        this.InitializeComponent();
        buttonCursor = new CoreCursor(CoreCursorType.Hand, 0);
    }

    private void Button_PointerEntered(object sender, PointerRoutedEventArgs e)
    {
        // Cache the cursor set before pointer enter on button.
        cursorBeforePointerEntered = Window.Current.CoreWindow.PointerCursor;
        // Set button cursor.
        Window.Current.CoreWindow.PointerCursor = buttonCursor;
    }

    private void Button_PointerExited(object sender, PointerRoutedEventArgs e)
    {
        // Change the cursor back.
        Window.Current.CoreWindow.PointerCursor = cursorBeforePointerEntered;
    }
}

설명

미리 정의된 Windows 커서를 사용하여 CoreCursor instance 만들려면 Custom 이외의 CoreCursorType 열거형에서 사용할 수 있는 커서 형식을 사용합니다. 이 경우 Id 속성은 무시됩니다.

사용자 지정 커서를 사용하려면 CoreCursorType.Custom 열거형 옵션을 사용하고 사용자 지정 커서의 ID 를 지정합니다. 사용자 지정 커서가 포함된 .res 리소스 파일을 프로젝트에 추가하고 /win32res 컴파일러 옵션을 사용하여 어셈블리에 포함할 수 있습니다. ID.res 파일에 지정된 커서 리소스 ID입니다.

생성자

CoreCursor(CoreCursorType, UInt32)

제공된 커서 형식의 새 CoreCursor instance 만듭니다.

속성

Id

커서의 리소스 ID를 가져옵니다.

Type

커서의 형식을 가져옵니다.

적용 대상