Escape Key is a command key, so you should achieve this with another trick, for example:
using System;
using System.Windows.Forms;
namespace HandleEscapeKeyDemo
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
protected override Boolean ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Escape)
{
OnPressEscapeKey();
}
return true;
}
private void OnPressEscapeKey()
{
MessageBox.Show("Escape Key Is Pressed");
}
}
}
Sheva
WORKS!
No comments:
Post a Comment