MoveWindow() приватный Метод

private MoveWindow ( IntPtr hwnd, int x, int y, int cx, int cy, bool repaint ) : bool
hwnd System.IntPtr
x int
y int
cx int
cy int
repaint bool
Результат bool
Пример #1
0
        /// <summary>
        /// Restores parent native MSI dialog after the previous <c>ReplaceHost</c> call.
        /// </summary>
        protected void RestoreHost()
        {
            Win32.RECT r;
            Win32.GetWindowRect(this.Handle, out r);

            Win32.RECT rHost;
            Win32.GetWindowRect(hostWindow, out rHost);

            Win32.MoveWindow(hostWindow, r.Left + delta, r.Top + delta, rHost.Right - rHost.Left, rHost.Bottom - rHost.Top, true);
            hostWindow.Show();
            this.Opacity = 0.01;

            Application.DoEvents();
        }
Пример #2
0
        /// <summary>
        /// 'Replaces' the current step dialog with the "itself".
        /// <para>It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog (itself)
        /// at the same desktop location and with the same size as the parent.</para>
        /// </summary>
        protected void ReplaceHost()
        {
            try
            {
                Win32.RECT r;
                Win32.GetWindowRect(hostWindow, out r);

                Win32.MoveWindow(this.Handle, r.Left - delta, r.Top - delta, r.Right - r.Left + delta * 2, r.Bottom - r.Top + delta * 2, true);

                this.Opacity = 1;
                Application.DoEvents();

                this.MaximumSize     =
                    this.MinimumSize = new Size(this.Width, this.Height); //prevent resizing

                hostWindow.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }