public void SwitchScene(Scene scene) { BaseUserControl ctrl = null; switch (scene) { case Scene.MenuScene: { ctrl = new MenuUserControl(); break; } case Scene.PlayerScene: { ctrl = new PlayerControl(); break; } case Scene.PlayerEditScene: { ctrl = new PlayerEditControl(); break; } case Scene.CombatLogScene: { ctrl = new CombatLogUserControl(); break; } case Scene.HitLogScene: { ctrl = new HitLogUserControl(); break; } default: { break; } } if (ctrl != null) { this.MinimumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); this.MaximumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); mainPanel.Height = ctrl.Height + 20; mainPanel.Width = ctrl.Width + 15; this.Text = ctrl.Name.ToString(); this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2); ctrl.Dock = DockStyle.Fill; mainPanel.Controls.Clear(); mainPanel.Controls.Add(ctrl); } }
private void InitialisePlayerPage() { playerEditControl = new PlayerEditControl(); playerPage = new TabPage("Player Editor"); playerEditControl.manager = manager; playerEditControl.playeroverall.InitRatings(manager); tabControl.Visible = true; tabControl.Dock = DockStyle.Fill; tabControl.Controls.Add(playerPage); playerPage.Controls.Add(playerEditControl); playerEditControl.Dock = DockStyle.None; playerEditControl.Model = model; playerEditControl.InitialiseUI(); }