Form Key Press action

image_pdfimage_print


   

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;

public class Form1 : System.Windows.Forms.Form{
   public Form1() {
      InitializeComponent();
   }
   private void InitializeComponent() {
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(292, 273);
      this.Name = "Form1";
      this.Text = "Form1";
      this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
   }

   static void Main() {
      Application.Run(new Form1());
   }

   private void Form1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {
      Console.WriteLine("Key Press");
   }
}