private void picCheck_Click(object sender, EventArgs e) { n = tbxNum.Text; a = 0; b = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (n[i] == ans[j]) { if (i == j) { a++; } else { b++; } } } } lblAns.Text = a.ToString() + " A " + b.ToString() + " B"; if (a == 4) { //過關 Finish finish = new Finish(); finish.BackGround(2); finish.FormClosed += new FormClosedEventHandler(view_FormClosed); //當pianoview關閉時,返回主畫面 finish.Show(); this.Hide(); } }