Easy Shortcut Keys in Windows Form C#

Protected override bool ProcessCmdKey(ref Message msg, Keys keyData) //Simple Put this code in Form and Assign the Keys and Line   of Code that must be executed on that key press.
{

if (keyData == (Keys.Control | Keys.X)) //On Pressing Ctrl + X the Event is Detected.
{

MessageBox.Show(“You Have Press Ctrl + X?”);
this.Close();
return true;

}

return base.ProcessCmdKey(ref msg, keyData);

}

Posts Tagged with…

Write a Comment

Your email address will not be published. Required fields are marked *