【发布时间】:2012-10-10 11:13:50
【问题描述】:
我做了一个方法来检测何时按下一个键,但它不起作用!这是我的代码
void KeyDetect(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W && firstload == true)
{
MessageBox.Show("Good, now move to that box over to your left");
firstload = false;
}
}
我也尝试过创建一个 keyeventhandler,但它说“无法分配给键检测,因为它是一个方法组”
public Gwindow()
{
this.KeyDetect += new KeyEventHandler(KeyDetect);
InitializeComponent();
}
【问题讨论】: