如何删除Windows 10上的白色触摸点

时间:2018-01-03 09:30:59

标签: windows-10 touch feedback

我正在为Windows 10 PC创建一个自助服务终端,其触摸屏仅作为输入界面。我要删除的是白色触摸点,它显示为视觉触摸反馈(主要是一个可以关闭的圆圈)。

有谁知道如何做到这一点。

如果有一个游标(* .cur)文件被使用但没有找到任何结果,我已经搜索了注册表。由于这个原因,我猜测触摸反馈的显示方式不同。

只是为了确保 - 我不想失去触控功能,只需要消除视觉反馈。

提前致谢

2 个答案:

答案 0 :(得分:1)

在 Windows 10 中,您可以使用指针消息来处理触摸。这将使 WPF 表现得像本机 UWP 应用程序行为。白点将消失,触摸移动动画得到修复。

如果您使用的是 .NET Core,请将此行添加到您的 App.xaml.cs 构造函数中:

public partial class App : Application
{
    public App()
    {
        AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true);
    }
}

对于 .NET Framework,您应该将 App.config 文件添加到项目中。内容如下:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
  </startup>
  <runtime>
    <AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.EnablePointerSupport=true" />
  </runtime>
</configuration>

来源:

How to enable pointer message support in WPF .NET Core

WPF will have a touch offset after trun on the WM_Pointer message

答案 1 :(得分:0)

对于WPF程序:

为了从WPF元素中删除触摸反馈,只需将Stylus.IsTapFeedbackEnabled依赖项属性设置为False。您可以选择样式:

<Style x:Key="yourStyle">
    <Setter Property="Stylus.IsTapFeedbackEnabled" Value="False" />
</Style>

您引用的白色触摸点实际上是一个光标。当您触摸屏幕时,Windows会覆盖控件的光标设置,它将使用触摸光标。为避免这种可怕的行为,可以将光标设置为Cursors.None,以便隐藏光标。将下面的代码粘贴到Window内,您将不再看到白色触摸点

protected override void OnPreviewTouchDown(TouchEventArgs e)
{
    base.OnPreviewTouchDown(e);
    Cursor = Cursors.None;
}

protected override void OnPreviewTouchMove(TouchEventArgs e)
{
    base.OnPreviewTouchMove(e);
    Cursor = Cursors.None;
}

protected override void OnGotMouseCapture(MouseEventArgs e)
{
    base.OnGotMouseCapture(e);
    Cursor = Cursors.Arrow;
}

protected override void OnPreviewMouseMove(MouseEventArgs e)
{
    base.OnPreviewMouseMove(e);
    if (e.StylusDevice == null)
        Cursor = Cursors.Arrow;
}

但是,当您使用鼠标时,您的光标将始终设置为Cursors.Arrow,不幸的是,您可能会丢失设置到窗口的其他光标。

对于Windows Forms程序:

看着Reference Source for Stylus.IsTapFeedbackEnabled,我发现一种似乎不在任何帖子中出现的方式。您可以在Windows窗体应用程序中禁用触摸/点击反馈的方法:

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace TouchWinform
{

    public class TouchForm : Form
    {

        private const string TOUCH_SUPPORT_CATEGORY = "Touch support";
        private const bool IS_PRESS_AND_HOLD_ENABLED_DEFAULT_VALUE = false;
        private const bool IS_FLICKS_ENABLED_DEFAULT_VALUE = false;
        private const bool IS_TAP_FEEDBACK_DEFAULT_VALUE = false;
        private const bool IS_TOUCH_FEEDBACK_DEFAULT_VALUE = false;

        /// <summary>
        /// Gets or sets a values indicating whether press and hold is enabled.
        /// </summary>
        [Category(TOUCH_SUPPORT_CATEGORY), Description("Gets or sets a values indicating whether press and hold is enabled."), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(IS_PRESS_AND_HOLD_ENABLED_DEFAULT_VALUE)]
        public bool IsPressAndHoldEnabled
        {
            get;
            set;
        } = IS_PRESS_AND_HOLD_ENABLED_DEFAULT_VALUE;

        /// <summary>
        /// Gets or sets a value indicating whether flicks are enabled.
        /// </summary>
        [Category(TOUCH_SUPPORT_CATEGORY), Description("Gets or sets a value indicating whether flicks are enabled."), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(IS_FLICKS_ENABLED_DEFAULT_VALUE)]
        public bool IsFlicksEnabled
        {
            get;
            set;
        } = IS_FLICKS_ENABLED_DEFAULT_VALUE;

        /// <summary>
        /// Gets or sets whether a value indicating whether tap feedback is enabled.
        /// </summary>
        [Category(TOUCH_SUPPORT_CATEGORY), Description("Gets or sets whether a value indicating whether tap feedback is enabled."), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(IS_TAP_FEEDBACK_DEFAULT_VALUE)]
        public bool IsTapFeedbackEnabled
        {
            get;
            set;
        } = IS_TAP_FEEDBACK_DEFAULT_VALUE;

        /// <summary>
        /// Gets or sets whether a value indicating whether touch feedback is enabled.
        /// </summary>
        [Category(TOUCH_SUPPORT_CATEGORY), Description("Gets or sets whether a value indicating whether touch feedback is enabled."), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(IS_TOUCH_FEEDBACK_DEFAULT_VALUE)]
        public bool IsTouchFeedbackEnabled
        {
            get;
            set;
        } = IS_TOUCH_FEEDBACK_DEFAULT_VALUE;

        /// <summary>
        /// Processes Windows messages.
        /// </summary>
        /// <param name="m">The Windows <see cref="Message"/> to process.</param>
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case 0x2CB:
                    m.Result = new IntPtr(1);
                    break;
                case 0x2CC:
                    uint flags = 0;
                    if (!IsPressAndHoldEnabled)
                        flags |= 1;
                    if (!IsTapFeedbackEnabled)
                        flags |= 8;
                    flags |= IsTouchFeedbackEnabled ? (uint)0x100 : 0x200;
                    if (!IsFlicksEnabled)
                        flags |= 0x10000;
                    m.Result = new IntPtr(flags);
                    break;
                default:
                    base.WndProc(ref m);
                    break;
            }
        }
    }
}

但是,由于某种原因,我不明白,它实际上没有用。如果有人有主意,我会听到的。