I want to make a game in C# Windows Forms Application. (Is it maybe a bad idea? :D)
I need to determine if key was pressed in my timer. The game is basicly objects like labels or pictureBoxes moving - their location is changed via timer and I need to determine when key is pressed.
I made the same game as a consoleApplication and I wanted to make a "graphic interface" for it, but obviously I can't use this part of my code:
if (Console.KeyAvailable)
{
...
}
I am pretty new to c# and programming itself, so I am truly sorry if my question is stupid :-)
Just handle the KeyPress
event of the control which will have the focus.
With Key press event, the event argument is of type KeyPressEventArgs
which will give you details of which key is pressed