更新时间:2023-12-06 10:10:52
处理的的KeyDown
事件,碰到这样的:
Handle the KeyDown
event and have something like:
if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.Up)
{
MessageBox.Show("My message");
}
事件处理程序是主窗体上,你需要设置的KeyPreview
属性真正
。这可以从属性对话框的设计模式来完成。
The event handler has to be on the Main Form and you need to set the KeyPreview
property to true
. This can be done in design mode from the properties dialog.