private void categoryButton_Click(object sender, EventArgs e) { activePanel.Height = categoryButton.Height; activePanel.Top = categoryButton.Top; CategoryUiController categoryUiController = new CategoryUiController(); mainPanel.Controls.Clear(); categoryUiController.Dock = DockStyle.Fill; categoryUiController.BringToFront(); categoryUiController.Focus(); mainPanel.Controls.Add(categoryUiController); }