i.e. anything interesting…
Using KeyPreview to handle form shortcut keys
If you need to trap shortcut keys in your application to perform misc tasks, use the following code to set KeyPreview to true and then in the KeyDown event handle the actual clicks:
private void Form_OnLoad(object sender, EventArgs e)
{
KeyPreview = true;
}
private void form_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt && e.KeyCode.ToString() == “L”)
{
//DO Something
}
}
| Print article | This entry was posted by Simon Steed on October 31, 2008 at 12:50 pm, and is filed under C# and ASP.Net. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.