AdvancedLauncher.Tools.Interop.RedirectedWindow.AlignClientAndScreen C# (CSharp) Method

AlignClientAndScreen() public method

Aligns the RedirectedWindow such that the specified client coordinate is aligned with the specified screen coordinate.
public AlignClientAndScreen ( int xClient, int yClient, int xScreen, int yScreen ) : void
xClient int
yClient int
xScreen int
yScreen int
return void
        public void AlignClientAndScreen(int xClient, int yClient, int xScreen, int yScreen)
        {
            POINT pt = new POINT(xClient, yClient);
            NativeMethods.ClientToScreen(Handle, ref pt);

            int dx = xScreen - pt.x;
            int dy = yScreen - pt.y;

            RECT rcWindow = new RECT();
            NativeMethods.GetWindowRect(Handle, ref rcWindow);

            NativeMethods.SetWindowPos(
                Handle,
                HWND.NULL,
                rcWindow.left + dx,
                rcWindow.top + dy,
                0,
                0,
                SWP.NOSIZE | SWP.NOZORDER | SWP.NOACTIVATE);
        }