Example #1
0
        public static System.Drawing.Point ScreenToClient(IntPtr hwnd, System.Drawing.Point p)
        {
            APIPOINT p2 = new APIPOINT();

            p2.x = p.X;
            p2.y = p.Y;
            if (ScreenToClient(hwnd, ref p2))
            {
                return(new System.Drawing.Point(p2.x, p2.y));
            }
            else
            {
                return(System.Drawing.Point.Empty);
            }
        }
Example #2
0
 public static System.Drawing.Point GetScreenMousePosition(System.Windows.Forms.Message msg)
 {
     if (msg.Msg == WM_MOUSEMOVE ||
         msg.Msg == WM_LBUTTONDBLCLK ||
         msg.Msg == WM_LBUTTONDOWN ||
         msg.Msg == WM_LBUTTONUP ||
         msg.Msg == WM_RBUTTONDBLCLK ||
         msg.Msg == WM_RBUTTONDOWN ||
         msg.Msg == WM_RBUTTONUP)
     {
         APIPOINT p = new APIPOINT();
         p.x = GetX(msg.LParam.ToInt32());
         p.y = GetY(msg.LParam.ToInt32());
         ClientToScreen(msg.HWnd, ref p);
         return(new System.Drawing.Point(p.x, p.y));
     }
     else
     {
         return(GetPoint(msg.LParam.ToInt32()));
     }
 }
Example #3
0
 private static extern bool DragDetect(System.IntPtr hWnd, APIPOINT pt);
Example #4
0
 private static extern bool ScreenToClient(IntPtr hwnd, ref APIPOINT pt);
Example #5
0
 private static extern bool ClientToScreen(IntPtr hwnd, ref APIPOINT pt);