The easiest way is to simply create a new instance of the form and close the old one. This requires a little operation, if this is the main form of your application, and closing the program will stop working. Start by opening Program.cs and edit it to look like this:
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppContext = new ApplicationContext();
AppContext.MainForm = new Form1();
Application.Run(AppContext);
}
public static ApplicationContext AppContext;
}
ApplicationContext , Form1. , Form1:
private void button1_Click(object sender, EventArgs e) {
Form1 frm = new Form1();
frm.StartPosition = FormStartPosition.Manual;
frm.Location = this.Location;
frm.Size = this.Size;
Program.AppContext.MainForm = frm;
frm.Show();
this.Close();
}