Pages

Saturday, June 20, 2015

How to Use Key Event Args in C#


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _10._1_keyboard
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            label1.Text = "Alt " + (e.Alt ? "Yes" : "No") + "\n" + " Shift"
                + (e.Shift ? " Yes" : "No") + " Ctrl " + (e.Control ? " Yes" : " No")
                + "\n" + "Key Code " + e.KeyCode + "\n" + "Key Value "
                + e.KeyValue + "\n" + "Key Data " + e.KeyData + "\n";

           
        }
    }
}



No comments:

Post a Comment