Windows应用程序中Enter/Tab键事件的秘密行为 [英] Covert behavier of Enter/Tab Key Event in Windows Application
本文介绍了Windows应用程序中Enter/Tab键事件的秘密行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望Enter键能够像Windows应用程序中的Tab键一样工作.
我的表单中有几个文本框.
我相应地设置了所有文本框的Tab属性.
现在,我希望只需编写很少的代码,Enter键就可以像Tab键一样工作
转到下一个所需的文本框.
目前,我在每个TextBox上使用Key_Up事件转到下一个所需的Textbox
这样.
I want that Enter Key will work Like Tab Key in my Windows Application.
There are several Text Boxes in my Forms.
I set Tab property of all Text Boxes accordingly Tab Key.
Now I want that with little codeing Enter Key will work like Tab Key
to go to next desired Textbox.
At present I am using Key_Up event on each TextBox to go to next desired Textbox
like this.
if (e.KeyCode==Keys.Enter)
txtName.Focus();
推荐答案
如果您具有 ^ ]设置为true.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.selectnextcontrol.aspx [ ^ ]
You can useSelectNextControl
in general on form itself, if you haveKeyPreview
[^] set to true.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.selectnextcontrol.aspx[^]
这篇关于Windows应用程序中Enter/Tab键事件的秘密行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文