网上找来的一段程序,手动按提示改了几次不行,求大神指点
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
namespace xxxxxx
{
public partial class Form1 : Form
{
private = null;
public Form1()
{
//初始化窗体中的各个组件
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
//清除程序中使用过的资源
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Name = "Form1";
this.Text = "C#处理键盘事件!";
//为按键的按动定义一个事件处理过程"Form1_KeyUp"
this.KeyUp += new KeyEventHandler(this.Form1_KeyUp);
}
static void Main()
{
Application.Run(new Form1());
}
//显示你所按动的按键名称
private void Form1_KeyUp(object sender, KeyEventArgs e)
{
MessageBox.Show(e.KeyCode.ToString(), "您所按动的健为:");
}
}
}