Reputation: 1
So I started programming today, and I want to make a small platforming stage in C#. I would like to know, how can I detect for example a left arrow key press. I can't find information that summarize my exact problem.
Upvotes: 0
Views: 546
Reputation: 126
private void Action_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Left)
{
// do something
}
}
Edit: Under Solution Explorer select some Form where you want to control key press feature. With right mouse click select View Designer. Next, under Properties section click on Events icon. Finally, find KeyDown Event and press Enter Key, it will result with a function which will handle key presses...
Upvotes: 1