Sunday, August 31, 2008

Alt Keys in C#

This sample code show on how to use Alt and Ctrl keys.


Try this code insert to your Form1_Keycode Event:


if ( e.Alt && e.KeyCode == Keys.S)
{//Pressed Alt+S}

else if (e.Alt && e.KeyCode == Keys.A)
{//Pressed Alt+A}

else if (e.Control && e.KeyCode == Keys.Y)
{//Pressed Ctrl+Y}

else if (e.Control && e.KeyCode == Keys.R)
{//Pressed Ctrl+R}

else if (e.Control && e.KeyCode == Keys.E)
{//Pressed Ctrl+E}

Hope this one can help you.

No comments: