private void SetControl(ViewToSelect view, cGameStatus status) { this.Controls.Clear(); switch (view) { case ViewToSelect.Main: startControl.Size = this.ClientSize; startControl.Status = status; startControl.updateUI(); this.Controls.Add(startControl); break; case ViewToSelect.Game: gameControl = new ucGame(viewChanger); gameControl.Dock = DockStyle.Fill; gameControl.Size = this.ClientSize; this.Controls.Add(gameControl); gameControl.StartGame(status); break; default: break; } }
public Form1() { InitializeComponent(); viewChanger = new SetControl(SetControl); gameControl = new ucGame(viewChanger); gameControl.Dock = DockStyle.Fill; startControl = new ucStartPanel(viewChanger); startControl.Dock = DockStyle.Fill; LoadGameFromFile(); SetControl(ViewToSelect.Main, status); this.ResizeEnd += (sender, e) => { gameControl.UcGame_CreateBackBuffer(sender, e); }; }