private void InstructionScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Space) { index++; instructionChange(); if (index == 3) { nextEnabled = true; } } if (e.KeyCode == Keys.Escape) { index--; instructionChange(); if (index == -1) { // Create an instance of the SecondScreen HighScoreScreen cs = new HighScoreScreen(); cs.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(cs); cs.Focus(); } } }
private void InstructionScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Space) { if (index == 0) { pictureBox1.Image = Properties.Resources.InstructionsSTART; } if (index == 1) { pictureBox1.Image = Properties.Resources.Instructions2; } if (index == 2) { nextEnabled = true; } index++; } if (e.KeyCode == Keys.Escape) { // Create an instance of the SecondScreen HighScoreScreen cs = new HighScoreScreen(); cs.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(cs); cs.Focus(); } }
private void CharacterSelect_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Right) { if (index < characters.Count - 1) { index++; } else { index = 0; } } if (e.KeyCode == Keys.Left) { if (index > 0) { index--; } else { index = 2; } } if (e.KeyCode == Keys.Space) { // Create an instance of the SecondScreen InstructionScreen cs = new InstructionScreen(); cs.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(cs); cs.Focus(); } if (e.KeyCode == Keys.Escape) { // Create an instance of the SecondScreen MainScreen ms = new MainScreen(); ms.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(ms); ms.Focus(); } if (e.KeyCode == Keys.M) { HighScoreScreen ms = new HighScoreScreen(); ms.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(ms); ms.Focus(); } Refresh(); }
private void MainScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Escape) { Application.Exit(); } else { // Create an instance of the SecondScreen HighScoreScreen cs = new HighScoreScreen(); cs.Location = new Point(this.Left, this.Top); // Add the User Control to the Form Form f = this.FindForm(); f.Controls.Remove(this); f.Controls.Add(cs); cs.Focus(); } }