コード例 #1
0
        /// <summary>
        /// Intercept and fire touch events
        /// </summary>
        /// <param name="hWnd">The Windows Handle</param>
        /// <param name="msg">Windows Message</param>
        /// <param name="wparam">wParam</param>
        /// <param name="lparam">lParam</param>
        /// <returns></returns>
        protected IntPtr WindowProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
        {
            if (msg == User32.WM_TOUCH)
            {
                foreach (InteropTouchEventArgs arg in Win32Touch.DecodeMessage(this.HwndWrapper, msg, wparam, lparam, DpiX, DpiY))
                {
                    if (TouchDown != null && arg.IsTouchDown)
                    {
                        TouchDown(this, arg);
                    }

                    if (TouchMove != null && arg.IsTouchMove)
                    {
                        TouchMove(this, arg);
                    }

                    if (TouchUp != null && arg.IsTouchUp)
                    {
                        TouchUp(this, arg);
                    }
                }
                handled = true;
            }
            if (msg >= User32.WM_MOUSEFIRST &&
                msg <= User32.WM_MOUSELAST &&
                User32.IsPenOrTouchMessage())
            {
                //Handle mouse events promoted from touch so promoted duplicate WPF mouse events don't occur
                handled = true;
            }
            return(IntPtr.Zero);
        }
コード例 #2
0
 public TouchHandler(Window window)
 {
     Win32Touch.DisableWPFTabletSupport();
     GetHandle(window);
     HwndWrapper = new WPFWindowWrapper(window);
 }