当我点击空格键时,我无法让计时器停止。当timer2达到0时,我可以让它们停止,这是空间响应的唯一时间,使定时器保持"滴答作响"和timer2开始计数负数。 C#
public void timer1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
if (timer1.Enabled == true)
{
timer1.Stop();
timer2.Stop();
}
else if (timer1.Enabled == false)
{
if (se == 0)
{
timer1.Enabled = false;
timer2.Enabled = false;
}
else
{
timer1.Start();
timer2.Start();
}
}
}
}