.NET求解

例如:我在键盘设定一个键,按下窗体隐藏,在按一下窗体显示,请各位帮帮忙,写写代码。。。小弟感谢

慕容708150
浏览 525回答 2
2回答

动漫人物

View Code在窗体的keyDown时间中写

慕码人8056858

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); }
打开App,查看更多内容
随时随地看视频慕课网APP