用窗體生成器自動生成的代碼
private void Form1_KeyDown(object sender, KeyEventArgs e) {
MessageBox.Show("af");
if (listBox1.Items.Contains(e.KeyCode)) {
listBox1.Items.Remove(e.KeyCode);
listBox1.Refresh();
//this part will increse the difficult of the game by putting down the interval
if (timer1.Interval > 400) timer1.Interval -= 10;
if (timer1.Interval > 250) timer1.Interval -= 8;
if (timer1.Interval > 100) timer1.Interval -= 2;
status.Update(true);
} else {
status.Update(false);
}
progressBar1.Value = 800 - timer1.Interval;
labelCorrect.Text = "correct: "+status.correct.ToString();
LabelMiss.Text = "missed: "+100;
labelTotal.Text = "total; "+status.total.ToString();
labelAccuracy.Text = "Accuracy: "+status.total.ToString();
}
按鍵之後程序無響應 對話框也彈不出來 求大神講解
Form的keypreview設置為true
看下Form1_KeyDown有沒有綁定到KeyDown事件上