日期:2014-05-17 浏览次数:20991 次
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 keyboardTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F1)//判断是否按下了F1功能键
{
MessageBox.Show("您按下了F1键!", "提示", MessageBoxButtons.OK);
}
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.KeyPreview = true;
this.BackColor = Color.Red;
}