private void button4_Click(object sender, EventArgs e) { Lvl4_8x8 f = new Lvl4_8x8(0); //this.Hide(); f.Show(); }
/// <summary> /// Check every icon to see if it is matched, by /// comparing its foreground color to its background color. /// If all of the icons are matched, the player wins. /// </summary> private void CheckForWinner() { // Go through all of the labels in the TableLayoutPanel, // checking each one to see if its icon is matched. foreach (Control control in tableLayoutPanel1.Controls) { Label iconLabel = control as Label; if (iconLabel != null) { if (iconLabel.ForeColor == iconLabel.BackColor) { return; } } } // If the loop didn’t return, it didn't find // any unmatched icons. // That means the user won. Show a message and close the form. MessageBox.Show("LEVEL-3 PASSED! You matched all the icons!", "Congratulations!"); Menu m = new Menu(); int[] a = m.readScoreFile(); bool check = false; for (int j = 0; j < 5; j++) { if ((i > a[j]) && (check == false)) { a[j] = i; check = true; } } m.writeScoreFile(a); Lvl4_8x8 f = new Lvl4_8x8(i); //this.Hide(); f.Show(); Close(); }