// Both below functions error out when given time to load public void OnEnd() { gameTimer.Enabled = false; Form f = this.FindForm(); f.Controls.Remove(this); GameOverScreen gos = new GameOverScreen(); f.Controls.Add(gos); gos.Focus(); }
public void OnWin() { gameTimer.Stop(); win = true; Form f = this.FindForm(); f.Controls.Remove(this); GameOverScreen gos = new GameOverScreen(); f.Controls.Add(gos); gos.Location = new Point((f.Width - gos.Width) / 2, (f.Height - gos.Height) / 2); gos.Focus(); }