gpt4 book ai didi

uwp - 在 UWP 应用中更改鼠标指针

转载 作者:行者123 更新时间:2023-12-04 02:35:46 26 4
gpt4 key购买 nike

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

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

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

最佳答案

不,这不可能隐藏光标,但您可以使用其他图标,例如:

  • 箭头
  • 十字
  • 定制
  • 帮助
  • IBeam

  • 使用 xaml 按钮并添加 PointerEntered按钮控件内的事件,如:
    <Button Name="button"  BorderThickness="2" PointerEntered="button_PointerEntered"  PointerExited="button_PointerExited">Button</Button>

    和 C# 代码:
     private void button_PointerEntered(object sender, PointerRoutedEventArgs e)
    {
    Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Hand, 1);
    }
    private void button_PointerExited(object sender, PointerRoutedEventArgs e)
    {
    Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
    }

    关于uwp - 在 UWP 应用中更改鼠标指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37956628/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com