2 回答
TA贡献1803条经验 获得超6个赞
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if ((msg.Msg == WM_KEYDOWN) ||(msg.Msg == WM_SYSKEYDOWN))
{
switch (keyData)
{
case Keys.Down:
this.Parent.Text = "向下键已经被捕捉";
break;
case Keys.Up:
this.Parent.Text = "向上键已经被捕捉";
break;
case Keys.Left:
this.Parent.Text = "向左键已经被捕捉";
break;
case Keys.Right:
this.Parent.Text = "向右键已经被捕捉";
break;
case Keys.Home:
this.Parent.Text = "Home 键已经被捕捉";
break;
case Keys.End:
this.Parent.Text = "End 键已经被捕捉";
break;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
- 2 回答
- 0 关注
- 524 浏览
添加回答
举报