zoukankan      html  css  js  c++  java
  • 判断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; } }
  • 相关阅读:
    opatch卸载weblogic12.1.3.0补丁
    linux weblogic12.1.3.0卸载过程
    pip install xxxx报错(一大堆红色exception)【解决】
    (CVE-2017-10271)weblogic12.1.3.0漏洞测试与打补丁过程
    linux 安装weblogic12.1.3.0步骤
    python基础实战之猜年龄游戏
    python基础小结
    计算机基础
    面向对象基础
    数据库总结
  • 原文地址:https://www.cnblogs.com/TianPing/p/10382009.html
Copyright © 2011-2022 走看看