What is the purpose of a keyboard mnemonic on a la

2019-06-18 23:50发布

问题:

What's the point of adding mnemonic on a label control in C#?

I have a label with the text "&SomeText".

What event is triggered when i press ALT+S (I've tried OnClick but it's not fired)

回答1:

The point of adding a mnemonic is to increase the accessibility of your app by reducing the reliance of a user on the mouse.

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.

So, the mnemonic is not for the label itself, but actually for the control next to it (+1 in the tab order).