Hello,
Try this:
private Form2 form2;
public Form1()
{
InitializeComponent();
this.form2 = new Form2();
HideForm(form2);
}
private void ShowButton_Click(object sender, EventArgs e)
{
ShowForm(form2);
HideForm(this);
}
private int height;
private int width;
private System.Windows.Forms.FormBorderStyle borderStyle;
private void ShowForm(Form form)
{
form.Visible = true;
form.FormBorderStyle = borderStyle;
form.Height = height;
form.Width = width;
}
private void HideForm(Form form)
{
height = form.Height;
width = form.Width;
borderStyle = form.FormBorderStyle;
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
form.Height = 0;
form.Width = 0;
form.Visible = false;
}