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 鼠标键盘事件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
textBox1.Text = "你按下的健是" + e.KeyCode;
if (e.KeyCode == Keys.Up)
{
textBox1.Text += ",即向上箭头!";
}
if (e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift))
{
textBox1.Text +=",即组合键Ctrl+Alt+Shift";
}
switch (e.KeyData)
{
case(Keys .Control |Keys .X):
textBox1.Text += "你按下的是Ctrl+X";
break;
case (Keys .Control |Keys .Y):
textBox1 .Text +="你按下的是Ctrl+Y";
break ;
}
}
}
}