zoukankan      html  css  js  c++  java
  • 2019-11-9-win10-支持默认把触摸提升-Pointer-消息

    title author date CreateTime categories
    win10 支持默认把触摸提升 Pointer 消息
    lindexi
    2019-11-09 15:32:31 +0800
    2018-2-13 17:23:3 +0800
    WPF 触摸

    在 WPF 经常需要重写一套触摸事件,没有UWP的Pointer那么好用。 如果一直都觉得 WPF 的触摸做的不好,或想解决 WPF 的触摸问题,但是没有方法,那么请看下面。

    只要新建框架为 .net 4.7 以上,运行的系统是Windows 10 Creators Update 就可以。

    打开新建的工程,设置框架。

    然后打开 App.config,添加支持把触摸和笔到鼠标

         <runtime>
            <AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.EnablePointerSupport=true"/>
        </runtime>

    需要知道,这个特性不支持实时的笔迹。

    因为笔迹需要运行在UI线程,会导致比较差的性能。

    开启了这个属性就可以使用 Pointer 消息。

    因为有小伙伴说使用了我上面代码无法打开 Pointer 消息,我看了他代码,发现他写错了,所以我把全部 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>

    参见:Mitigation: Pointer-based Touch and Stylus Support

  • 相关阅读:
    eclipse建立工作集管理项目
    echarts-x
    GeoJSON
    mysql 5.7 root password 过期
    kubernetes centos7
    JestClient
    树莓派镜像制作
    docker run elasticsearch
    vm.max_map_count
    远程访问jupyter notebook
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085809.html
Copyright © 2011-2022 走看看