Esempio n. 1
0
        /// <summary>
        /// Decode WM_Gesture Message using wParam and raise suitable Events
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="mgsID"></param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <param name="bHandled"></param>
        /// <returns></returns>
        private bool DecodeGesture(IntPtr hwnd, int mgsID, IntPtr wParam, IntPtr lParam, ref bool bHandled)
        {
            GESTUREINFO gi = new GESTUREINFO();

            gi.cbSize = Marshal.SizeOf(new GESTUREINFO());

            // Load the gesture information.
            // We must p/invoke into user32 [winuser.h]
            if (!GetGestureInfo(lParam, ref gi))
            {
                return(false);
            }

            try
            {
                switch (gi.dwID)
                {
                case GID_BEGIN:
                    GestureBegin(_handle, new GestureEventArgs(gi));
                    break;

                case GID_END:
                    GestureEnd(_handle, new GestureEventArgs(gi));
                    break;

                case GID_ZOOM:
                    GestureZoom(_handle, new GestureEventArgs(gi));
                    break;

                case GID_PAN:
                    GesturePan(_handle, new GestureEventArgs(gi));
                    break;

                case GID_PRESSANDTAP:
                    GesturePressAndTap(_handle, new GestureEventArgs(gi));
                    break;

                case GID_ROTATE:
                    GestureRotate(_handle, new GestureEventArgs(gi));
                    break;

                case GID_TWOFINGERTAP:
                    GestureTwoFingerTap(_handle, new GestureEventArgs(gi));
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.Print(this.GetType() + ":DecodeGestureError:  " + ex.Message);
            }



            return(true);
        }
Esempio n. 2
0
 private static extern bool GetGestureInfo(IntPtr hGestureInfo, ref GESTUREINFO pGestureInfo);
Esempio n. 3
0
 public GestureEventArgs(GESTUREINFO gi)
 {
     _point = new Point(gi.ptsLocation.x, gi.ptsLocation.y);
     _args  = gi.ullArguments;
     _gi    = gi;
 }