// Switches from one panel to another by making it visible and hiding the others private void SetPanel(GamePanel panel) { foreach (Panel p in panels) { if (p.Name.ToLower().Contains(panel.ToString().ToLower())) { if (currentPanel != null) { currentPanel.Visible = false; } currentPanel = p; currentPanel.Visible = true; currentGamePanel = panel; BackColor = currentPanel.BackColor; break; } } // Load events for specific panels switch (currentGamePanel) { case GamePanel.Ip: IPTextBox.Text = NetworkHandler.GetLocalIpAddress().ToString(); break; case GamePanel.Lobby: break; case GamePanel.Question: break; case GamePanel.Wait: break; case GamePanel.Scores: break; default: break; } }