Do you like something like this
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
this.Focus();
this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Space)
{
i += 1;
label1.Text = "Worked !";
if (i == 10)
{
button1.Enabled = true;
label1.Text = "Finished !";
}
}
}
----------------------------------------------
Hope above help !
Doanh
No comments:
Post a Comment