C Sharp的Windows应用程序中按钮控件的Click/Enter键事件的区别 [英] Difference on Click/Enter Key event of Button control in Windows Application of C Sharp

查看:152
本文介绍了C Sharp的Windows应用程序中按钮控件的Click/Enter键事件的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#锋利的Windows应用程序中更新鲜

我的表单和按钮上有一些文本框.

在每个TextBox控件上,我都设置了KeyUP事件来设置焦点.

通常,在按Enter键时转到我想要的下一个文本框控件,在按UP方向键时转到上一个文本控件.

现在,问题是当我单击按钮"转到第一个文本框"时.然后它将运行确定并转到第一个文本框.

但是,当我按Enter on Button而不是Click时,控制也转到第一个文本框,同时在文本框上输入Enter键事件,结果焦点转到第二个文本框,而不是第一个文本框.

是什么原因.
请帮助我.

I am fresher in C# sharp Windows Application

I have some textboxes on my form and buttons.

On Every TextBox control I have set KeyUP event to set the focus.

Generally, On Press of Enter Key go to my desired next textbox control and on Press of UP arrow key go to previous text control.

Now, problem is when I Click on Button to go to First TextBox. then it will run Ok and go to First Text Box.

But when I press Enter on Button instead of Click then control go to first textbox with a Enter Key event on textbox also and results focus goes to second text box instead of first text box.

What is the Reason.

Please Help me.

推荐答案

它看起来有两个很多按钮,这表明设计不好.他们的目的是什么?而且,控件之间的导航应该是用户期望的标准操作.

也就是说,您应该更改设计.尝试使用单元格中带有某些控件的网格视图;它将为您提供灵活,标准和预期的单元格之间导航.

—SA
It looks there are two many buttons, which is a sign of bad design. What is their purpose? Also, navigation between controls should be standard, as expected by the user.

That said, you should rather change design. Try to use a grid view with some controls in the cells; it will provide you with flexible, standard and expected navigation between cells.

—SA


这篇关于C Sharp的Windows应用程序中按钮控件的Click/Enter键事件的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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