在UWP应用中更改鼠标指针

问题描述:

是否可以在UWP应用中更改甚至隐藏鼠标指针? 我唯一能找到的就是这个:

Is it possible to change or even hide the mouse-pointer in a UWP app? The only thing I can find is this :

Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = null;

Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = null;

但是在UWP中,这不起作用.

But in UWP, this doesn't work.

是的,可以通过设置 Window.Current.CoreWindow.PointerCursor.如果将其设置为null,则指针将被隐藏.否则,您可以使用CoreCursorType枚举设置特定的系统点.例如,使用它来设置箭头类型:

Yes this can be done by settings the Window.Current.CoreWindow.PointerCursor. If you set it to null, the pointer is hidden. Otherwise you can use the CoreCursorType enumeration to set a specific system point. For instance use this to set the Arrow type:

Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 0);

您还可以使用资源文件添加自定义指针.有关详细信息,请请参阅此博文.

You can also add custom pointers by using a resource file. For details, see this blogpost.