public static bool RecognizeGesture(IntPtr handle, int x, int y) { SHRGINFO shrg = new SHRGINFO(); shrg.cbSize = 20; shrg.hwndClient = handle; shrg.dwFlags = 3; shrg.ptDownx = x; shrg.ptDowny = y; return (SHRecognizeGesture(ref shrg) == 0x3e8); }
public static bool RecognizeGesture(IntPtr handle, int x, int y) { SHRGINFO shrg = new SHRGINFO(); shrg.cbSize = 20; shrg.hwndClient = handle; shrg.dwFlags = 3; shrg.ptDownx = x; shrg.ptDowny = y; return(SHRecognizeGesture(ref shrg) == 0x3e8); }
// End -- SHRecognizeGesture declarations. protected override void WndProc( ref Microsoft.WindowsCE.Forms.Message msg) { switch (msg.Msg) { case WM_MOUSEMOVE: break; case WM_LBUTTONDOWN: int xyBundle = (int)msg.LParam; int x = xyBundle & 0xffff; int y = (xyBundle >> 16); SHRGINFO shinfo; shinfo = new SHRGINFO(); shinfo.cbSize = Marshal.SizeOf(shinfo); shinfo.hwndClient = m_hwndTarget; shinfo.ptDown.X = x; shinfo.ptDown.Y = y; shinfo.dwFlags = SHRG_RETURNCMD; if (SHRecognizeGesture(ref shinfo) == GN_CONTEXTMENU) { Point pt = new Point(x, y); Point pt2 = m_ctrlTarget.PointToScreen(pt); m_ctrlTarget.ContextMenu.Show(m_ctrlTarget, pt2); // We handle event. // Do not pass to original wndproc msg.Result = IntPtr.Zero; } else { // Tell handler to send to original wndproc msg.Result = (IntPtr)1; } break; case WM_LBUTTONUP: break; case WM_KEYDOWN: break; case WM_KEYUP: break; case WM_CHAR: break; } // switch } // WndProc
internal static bool IsContextMenu(MouseEventArgs e, IntPtr handle) { if (e.Button != MouseButtons.Left) { return false; } SHRGINFO structure = new SHRGINFO(); structure.cbSize = (uint) Marshal.SizeOf(structure); structure.hwndClient = handle; structure.x = e.X; structure.y = e.Y; structure.dwFlags = 1; return (SHRecognizeGesture(structure) == 0x3e8); }
public static bool RecognizeGesture(IntPtr handle, int x, int y) { if (Environment.OSVersion.Platform == ((PlatformID) 0xc0)) { return false; } SHRGINFO shrg = new SHRGINFO(); shrg.cbSize = 20; shrg.hwndClient = handle; shrg.dwFlags = 3; shrg.ptDownx = x; shrg.ptDowny = y; return (SHRecognizeGesture(ref shrg) == 0x3e8); }
public static bool RecognizeGesture(IntPtr handle, int x, int y) { if (Environment.OSVersion.Platform == ((PlatformID)0xc0)) { return(false); } SHRGINFO shrg = new SHRGINFO(); shrg.cbSize = 20; shrg.hwndClient = handle; shrg.dwFlags = 3; shrg.ptDownx = x; shrg.ptDowny = y; return(SHRecognizeGesture(ref shrg) == 0x3e8); }
internal static bool IsContextMenu(MouseEventArgs e, IntPtr handle) { if (e.Button != MouseButtons.Left) { return(false); } SHRGINFO structure = new SHRGINFO(); structure.cbSize = (uint)Marshal.SizeOf(structure); structure.hwndClient = handle; structure.x = e.X; structure.y = e.Y; structure.dwFlags = 1; return(SHRecognizeGesture(structure) == 0x3e8); }
internal static extern int SHRecognizeGesture(ref SHRGINFO shrg);
internal static extern uint SHRecognizeGesture(SHRGINFO shrg);
internal static extern uint SHRecognizeGesture(SHRGINFO shrg);
internal static extern int SHRecognizeGesture(ref SHRGINFO shrg);