OnKeyDown event : Form Event : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » Form Event »

 

OnKeyDown event








    
 


using System;
using System.Drawing;
using System.Windows.Forms;
   
class ExitOnX: Form
{
     public static void Main()
     {
          Application.Run(new ExitOnX());
     }
     public ExitOnX()
     {
          Text = "Exit on X";
     }
     protected override void OnKeyDown(KeyEventArgs kea)
     {
          if (kea.KeyCode == Keys.X)
               Close();
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» Form Event