keyboard

 

   <= https://*.com/questions/5977177/how-to-close-a-winform-with-keyboard-while-a-control-has-focus

protected override bool ProcessDialogKey(Keys keyData)

KeyPreview
keyboard
You need to set the form's KeyPreview property to true. This will enable the form to capture keypresses before they are passed on to the controls on it, which makes it possible for you to intercept them and pass them on if you want to, or do something else, like closing the form with your key combination.
Set the KeyPreview property of the Form to true(it will transfer the keyborad event to form before the controls.), and write code on the KeyXXX event, and check for ESC key and call this.close()
View Code

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

END

上一篇:Android软键盘推视图


下一篇:android – 如何防止键盘隐藏我的EditText?