/// <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(); }
/// <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()); } }