判断Mouse事件源类型
//鼠标事件源类型
public enum MouseEventSource
{
Mouse,
Pen,
Touch
}
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
inkcv.PreviewMouseDown += Inkcv_PreviewMouseDown;
inkcv.PreviewMouseMove += Inkcv_PreviewMouseMove;
inkcv.PreviewMouseUp += Inkcv_PreviewMouseUp; } private void Inkcv_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
var s = GetMouseEventSource();
result.Text = "mouse up,Source: "+ s.ToString();
} private void Inkcv_PreviewMouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton==MouseButtonState.Pressed)
{
result.Text ="mouse move,Source: "+ GetMouseEventSource().ToString();
} } private void Inkcv_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var s = GetMouseEventSource();
result.Text = "mouse previewdown,Source: "+ s.ToString();
} [DllImport("user32.dll")]
private static extern uint GetMessageExtraInfo();
public static MouseEventSource GetMouseEventSource()
{
uint extra = GetMessageExtraInfo();
bool isTouchOrPen = ((extra & 0xffffff00) == 0xff515700);
if (!isTouchOrPen)
return MouseEventSource.Mouse;
bool isTouch = ((extra & 0x00000080) == 0x00000080);
return isTouch ? MouseEventSource.Touch : MouseEventSource.Pen;
}
}
判断Mouse事件源类型的更多相关文章
- 纯JS判断各种浏览器类型及版本.
IE11或者非IE if (!document.all) { alert('IE11+ or not IE'); } IE10 if (document.all && document ...
- 根据判断PC浏览器类型和手机屏幕像素自动调用不同CSS的代码
1.媒体查询方法在 css 里面这样写 -------------------- @media screen and (min-width: 320px) and (max-width: 480px) ...
- 判断密文加密类型hash-identifier
判断密文加密类型hash-identifier 在安全领域中,加密数据随处可见.而在这些数据中,重要的数据往往采用哈希算法进行加密.例如,Linux密码使用sha512,Windows密码采用LM ...
- 彻底解决android读取中文txt的乱码(自动判断文档类型并转码
原文:http://blog.csdn.net/handsomedylan/article/details/6138400 public String convertCodeAndGetText(St ...
- Unity 网络斗地主 判断牌的类型
Unity 网络斗地主 牌的类型 web版本演示地址: http://www.dreamhome666.com/Desktop.html 在上个版本中,下面的角色在牌的后面,可以将角色做为一个P ...
- Android 判断文件的类型
import java.util.HashMap; import java.util.Iterator; /** * 判断文件的类型 */ public class MediaFileUtil { p ...
- JavaScript判断对象的类型
JavaScript判断对象的类型 最近阅读了一些关于JavaScript判断对象类型的文章.总结下来,主要有constructor属性.typeof操作符.instanceof操作符和Object. ...
- 在C中判断变量存储类型(字符常量/数组/动态变量)
在C中判断变量存储类型(字符常量/数组/动态变量) 在chinaunix论坛上有人问到关于变量存府类型的问题,我觉得可以写个测试代码加深大家对内存使用和布局的理解.下面我把原问题及处理办法贴出来,限供 ...
- Java进阶(三十) 判断字符串编码类型
java 判断字符串编码类型 public static String getEncoding(String str) { String encode = "GB2312"; tr ...
随机推荐
- python, Django 的安装
yum install zlib yum install zlib-devel yum install openssl-devel 否则导致安装setuptools出错,还需要重新编译python 如 ...
- 系统批量运维管理器pexpect的使用
# pip install pexpect 或 # easy_install pexpect 1 #!/usr/bin/env python 2 import pexpect 3 child = pe ...
- Ubuntu技巧之清理系统中无用的软件包
如果你频繁的在你的系统中安装/卸载,那么不时的清理一下你的系统是十分必要的. 在Ubuntu终端中执行如下命令: sudo apt-get autoremove 屏幕输出是这个样子的: Reading ...
- Haskell语言学习笔记(44)Lens(2)
自定义 Lens 和 Isos -- Some of the examples in this chapter require a few GHC extensions: -- TemplateHas ...
- neo4j 学习-1
Neo4j 子句 ```MATCH (:Person { name: 'an' })-[r]->(:Persion) RETURN type(r) // 返回关系的类型 如:r 就是 'KNOW ...
- etcd ui
https://github.com/henszey/etcd-browser docker build --build-arg http_proxy=http://109.105.4.17:3128 ...
- kubectl 获取信息
获取pod所在节点的ip kubectlget po tiller-deploy-8694f8fddc-c2rql -n kube-system -o jsonpath='{.status.hostI ...
- 第五章 二叉树(c)二叉树
- CentOS下zabbix监控mysql5.6版本主从
目录 CentOS下zabbix监控mysql5.6版本主从 1. Zabbix添加自定义监控流程 2. 具体步骤 1. 编写监控mysql主从脚本 2. mysql赋权 3. 查看脚本执行效果 4. ...
- discuz的diy功能介绍
可以通过页面操作的方式,完成页面布局设计,数据聚合,样式等常见的页面处理功能. 以管理员登陆discuz的前台时,会出现一个diy按钮. 流程,先设计框架,再完成数据的聚合. 定义模板时, ...