private void homeButton_Click(object sender, EventArgs e) { //Remove the cuurent panel and load the home panel HomePanel panel = new HomePanel(); this.Parent.Invoke(new MethodInvoker(delegate() { this.Parent.Controls.Add(panel); })); this.Parent.Invoke(new MethodInvoker(delegate() { this.Parent.Controls.Remove(this); })); panel.Initialize(); }
public Form1() { InitializeComponent(); //Resize thw window to be a square this.Size = new Size(this.Width, this.Width); //Load the home window HomePanel panel = new HomePanel(); panel.Parent = this; this.Controls.Add(panel); panel.Initialize(); }