> static class Program > { > [STAThread] > static void Main() > { > Application.EnableVisualStyles(); > Application.SetCompatibleTextRenderingDefault(false); > Form1 frm = new Form1(); > frm.KeyPress += new KeyPressEventHandler(new KeyPressCode().keypressEvent); > frm.KeyDown += new KeyEventHandler(new KeyPressCode().keydownEvent); > Application.Run(frm); > } > } > > public class KeyPressCode > { > public void keypressEvent(object sender, KeyPressEventArgs e) > { > if (e.KeyChar == (char)Keys.Escape) > { > MessageBox.Show("Key ESCAPE pressed."); > } > } > > public void keydownEvent(object sender, KeyEventArgs e) > { > if (e.Control && e.KeyCode == Keys.A) > { > MessageBox.Show("Key CTRL + A pressed"); > } > } > } >>