编程语言
首页 > 编程语言> > C# WINFORM中捕捉界面中按键ESC

C# WINFORM中捕捉界面中按键ESC

作者:互联网

//直接复制此代码到FORM代码下面即可
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) //激活回车键 { int WM_KEYDOWN = 256; int WM_SYSKEYDOWN = 260; if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN) { switch (keyData) { case Keys.Escape: bTryLineDraw = false; break; default: break; } } return false; }

 

搜索

复制

标签:C#,WM,System,Msg,Forms,int,ESC,msg,WINFORM
来源: https://www.cnblogs.com/swtool/p/16413005.html