internal static extern bool GetGestureInfo(IntPtr hGestureInfo, ref GESTUREINFO pGestureInfo);
public bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return(false); } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!Win32.GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case Win32.GID_BEGIN: { Console.WriteLine("touch begin"); break; } case Win32.GID_END: { Console.WriteLine("touch end"); break; } case Win32.GID_PAN: switch (gi.dwFlags) { case Win32.GF_BEGIN: Console.WriteLine("PAN BEGIN: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_INERTIA: //In this case the ullArguments encodes direction and velocity Console.WriteLine("PAN INERTIA: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_END: Console.WriteLine("PAN END: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_END | Win32.GF_INERTIA: Console.WriteLine("PAN END: " + gi.ToString() + System.Environment.NewLine); break; default: Console.WriteLine("PAN: " + gi.ToString() + System.Environment.NewLine); break; } break; } return(true); }
public bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return false; } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!Win32.GetGestureInfo(m.LParam, ref gi)) { return false; } switch (gi.dwID) { case Win32.GID_BEGIN: { Console.WriteLine("touch begin"); break; } case Win32.GID_END: { Console.WriteLine("touch end"); break; } case Win32.GID_PAN: switch (gi.dwFlags) { case Win32.GF_BEGIN: Console.WriteLine("PAN BEGIN: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_INERTIA: //In this case the ullArguments encodes direction and velocity Console.WriteLine("PAN INERTIA: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_END: Console.WriteLine("PAN END: " + gi.ToString() + System.Environment.NewLine); break; case Win32.GF_END | Win32.GF_INERTIA: Console.WriteLine("PAN END: " + gi.ToString() + System.Environment.NewLine); break; default: Console.WriteLine("PAN: " + gi.ToString() + System.Environment.NewLine); break; } break; } return true; }