标签控件上的键盘助记符的目的是什么? [英] What is the purpose of a keyboard mnemonic on a label control?
问题描述
在C#中的标签控件上添加助记符有什么意义?
What's the point of adding mnemonic on a label control in C#?
我有一个带有文本"&SomeText"
的标签.
I have a label with the text "&SomeText"
.
当我按ALT + S时会触发什么事件(我曾尝试过OnClick,但未触发)
What event is triggered when i press ALT+S (I've tried OnClick but it's not fired)
推荐答案
添加助记符的目的是通过减少用户对鼠标的依赖来增加应用程序的可访问性.
The point of adding a mnemonic is to increase the accessibility of your app by reducing the reliance of a user on the mouse.
如果您有一个在标签后直接具有tabindex的控件,则调用助记符将在控件上触发"enter"事件.您会注意到焦点转移到了此控件.
If you have a control that has a tabindex directly after the label, then invoking the mnemonic will fire the "enter" event on the control. You will notice the focus shift to this control.
因此,助记符不是用于标签本身,而是实际上用于其旁边的控件(按Tab键顺序为+1).
So, the mnemonic is not for the label itself, but actually for the control next to it (+1 in the tab order).
这篇关于标签控件上的键盘助记符的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!