private void FoodButton_Click(object sender, EventArgs e) { FoodButton.Visible = false; DrinkButton.Visible = true; Inventory.Visible = true; _obj = this; if (FoodPage.Instance.panel2.Controls.ContainsKey("UserControl3")) { panel2.Controls["UserControl3"].SendToBack(); } else { panel2.Controls["UserControl8"].SendToBack(); } UserControl4 uc = new UserControl4(); uc.Dock = DockStyle.Fill; panel2.Controls.Add(uc); panel2.Controls["UserControl4"].BringToFront(); if (FoodPage.Instance.panel3.Controls.ContainsKey("UserControl6")) { panel3.Controls["UserControl6"].SendToBack(); } else { panel3.Controls["UserControl7"].SendToBack(); } UserControl5 uc1 = new UserControl5(); uc.Dock = DockStyle.Fill; panel3.Controls.Add(uc1); panel3.Controls["UserControl5"].BringToFront(); }
private void Form2_Load(object sender, EventArgs e) { FoodButton.Visible = false; _obj = this; UserControl4 uc = new UserControl4(); uc.Dock = DockStyle.Fill; panel2.Controls.Add(uc); UserControl5 uc1 = new UserControl5(); uc.Dock = DockStyle.Fill; panel3.Controls.Add(uc1); }