예제 #1
0
        public static HwndRectInfo GetRectInfo(IntPtr hwnd)
        {
            var clientNativeRect       = NativeMethodsSafe.GetClientRect(hwnd);
            var windowScreenNativeRect = NativeMethodsSafe.GetWindowRect(hwnd);
            var topLeft     = NativeMethodsSafe.ClientToScreen(hwnd, clientNativeRect.Position);
            var bottomRight = NativeMethodsSafe.ClientToScreen(hwnd, new POINT {
                x = clientNativeRect.Right, y = clientNativeRect.Bottom
            });
            var clientScreenNativeRect = new RECT
            {
                Left   = topLeft.x,
                Top    = topLeft.y,
                Right  = bottomRight.x,
                Bottom = bottomRight.y
            };

            return(new HwndRectInfo(windowScreenNativeRect.ToPresentationRect(), clientNativeRect.ToPresentationRect(), clientScreenNativeRect.ToPresentationRect()));
        }
예제 #2
0
 private Point GetScreenPosition(IntPtr handle, IntPtr lParam)
 {
     return(NativeMethodsSafe.ClientToScreen(handle, WinAPIHelper.GetPoint(lParam)).ToPresentationPoint());
 }