public static DialogResult Show() { pauseForm = new PauseForm(); pauseForm.ShowDialog(); return(buttonResult); }
public void GameScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { //Opens a pause screen if escape is pressed. //Depending on what is pressed on pause screen the program will either continue or exit to main menu. if (e.KeyCode == Keys.Escape && gameTimer.Enabled) { gameTimer.Enabled = false; rightArrowDown = leftArrowDown = false; DialogResult result = PauseForm.Show(); if (result == DialogResult.Cancel) { gameTimer.Enabled = true; } else if (result == DialogResult.Abort) { MainForm.ChangeScreen(this, "MenuScreen"); } } //player button presses switch (e.KeyCode) { case Keys.Left: leftArrowDown = true; break; case Keys.Right: rightArrowDown = true; break; } }