先将窗口的KeyPreview设置为true,然后再在窗口的KeyPressUp事件中写代码就可以了
private void fmAlarmGroupConfig_add_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 27)
{
this.Close();
}
}
先将窗口的KeyPreview设置为true,然后再在窗口的KeyPressUp事件中写代码就可以了
private void fmAlarmGroupConfig_add_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 27)
{
this.Close();
}
}