コード例 #1
0
 public virtual void ClientToScreen(ref Rectangle clientRect, out Rectangle screenRect)
 {
     screenRect = clientRect;
     User32Helpers.MapWindowPoints(this.Handle, IntPtr.Zero, ref screenRect);
     User32Methods.AdjustWindowRectEx(ref screenRect, this.GetStyles(),
                                      User32Methods.GetMenu(this.Handle) != IntPtr.Zero, this.GetExStyles());
 }
コード例 #2
0
 public virtual void ScreenToClient(ref Rectangle screenRect, out Rectangle clientRect)
 {
     clientRect = screenRect;
     User32Helpers.MapWindowPoints(IntPtr.Zero, this.Handle, ref clientRect);
     User32Helpers.InverseAdjustWindowRectEx(ref clientRect, this.GetStyles(),
                                             User32Methods.GetMenu(this.Handle) != IntPtr.Zero, this.GetExStyles());
 }
コード例 #3
0
        private Point ScreenToClient(Point point)
        {
            var client = new Rectangle();

            User32Methods.AdjustWindowRectEx(ref client, GetStyles(), User32Methods.GetMenu(Handle) != IntPtr.Zero,
                                             GetExStyles());
            GetWindowRect(out Rectangle window);

            return(new Point(point.X - window.Left + client.Left, point.Y - window.Top + client.Top));
        }