Hey I have this piece of code:
private void Window_KeyUp(object sender, KeyEventArgs e)
{
if (playing == false)
{
return;
}
if (e.KeyCode == Keys.D1)
{
pictureBox6.Image = Form.Properties.Resources.black_square_button;
player.Stop();
player.Close();
playing = false;
}
}
I'ts not working but the Window_KeyDown() works.
What is wrong with my code?
Thanks.
The KeyUp event (also KeyDown and KeyPress) are triggered at the form level only if the form has
KeyPreview = true;
MSDN here
true if the form will receive all key events; false if the currently selected control on the form receives key events. The default is false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With