Esempio n. 1
0
        public static WindowHitTestResult HitTest(IntPtr hwnd)
        {
            if (hwnd == IntPtr.Zero)
            {
                return(WindowHitTestResult.Outside);
            }

            var hwndRectInfo     = GetRectInfo(hwnd);
            var cursorPoint      = NativeMethodsSafe.GetCursorPos().ToPresentationPoint();
            var insideClientArea = hwndRectInfo.ClientScreenRect.Contains(cursorPoint);
            var insideWindow     = hwndRectInfo.WindowScreenRect.Contains(cursorPoint);

            if (insideWindow == false)
            {
                return(WindowHitTestResult.Outside);
            }

            return(insideClientArea ? WindowHitTestResult.ClientArea : WindowHitTestResult.NonClientArea);
        }
Esempio n. 2
0
 private static Point GetScreenPosition()
 {
     return(NativeMethodsSafe.GetCursorPos().ToPresentationPoint());
 }