输入键作为遍历键 [英] enter key as traversal key

查看:111
本文介绍了输入键作为遍历键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在dotnet中使用数据网格视图,在该网络中,我想通过Enter键逐列遍历,它必须逐列而不是最后一列遍历,假设我在数据网格视图中有5列,并且现在开始使用第一列按回车键,它必须访问第二列而不是最后一行,如果我按了当前行的第三列的回车键,并且忘记更新当前行或上一行的上一列中的任何值,我可以将光标移到所需的列,并在更新了该列中的值之后,我想通过按Enter键再次开始从该列遍历到最后一列(逐列).

i am using data grid view in dotnet in which i want to traverse column by column through enter key it must traverse column by column not by last column suppose i have 5 columns in data grid view and started using the first column now after pressing enter key it must visit the second column not the last and if i pressed the enter key in the 3rd column in the current row and forgot to update any value in the previous colurmn of the current row or previous row i can move my cursor at the required column and after updating the value in that column i want to start traversing once again from the column to last column (column by column )by pressing enter key .

推荐答案

我强烈建议您重新考虑.

用户通常希望ENTER产生一个按钮,或通常提交一个页面.要在各个领域之间迁移,他们希望使用TAB.
除非您有* VER **很好的理由来更改此行为,否则您只会使用户感到困惑和烦恼,这意味着他们将不会使用您的程序.
I would strongly suggest that you reconsider.

Users generally expect ENTER to effect a button, or submit a page generally. To move from field to field, they expect to use TAB.
Unless you have a *VERY* good reason for changing this behaviour you will just confuse and annoy your users, and that means they won''t use your program.


我会写一个事件网格的Keypress事件的事件处理程序,然后查找Enter键.然后将手动将焦点设置到下一列.不要忘记设置e.Handled = True.
I would write an event handler for the Keypress event for the grid and look for the enter key. Then would manually set the focus to the next column. Don''t forget to set the e.Handled = True.


我发现可能是一种更好的模拟按键的方法:

I have found probably a better way to simulate key strokes:

System.Windows.Forms.SendKeys.Send("{TAB}");



请参阅



See http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WINDOWS.FORMS.SENDKEYS.SEND);k(SEND);k(SOLUTIONITEMSPROJECT);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true[^]


这篇关于输入键作为遍历键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆