How can I perform an Alt key press while my application is loading?
how to perform alter key press at the time of form loading in vb.net winforms application?
Means when the form's(devExpress's Xtraform) load event is executed that time alt key must be pressed pro-grammatically . Is it pos开发者_运维技巧sible? If yes please suggest some code.
thanks.
I would like to clarify how our controls work. In fact, you are talking not about button's shortcuts, but accelerator keys which activate a button's action if the Alt+AnyKey is pressed. To define this accelerator key, the &
symbol is included in the button's Text
property.
On all versions of Windows since 2000, the default behavior is to hide the keyboard accelerators, meaning that you won't see this underline in the control's caption. This underlining is only visible when the Alt key is pressed. If you want that this effect to be always visible, it is necessary to adjust a setting in MS Windows itself, as explained here:
Always show menu underline (keyboard accelerators)
However, note that the keyboard accelerators will still work, even when the underlines are not visible. The user can trigger the appropriate command by pressing Alt+AnyKey at any time.
Use in the form load section
System.Windows.Forms.SendKeys.SendWait("%")
System.Windows.Forms.SendKeys.SendWait("Esc")
Problem solved!
精彩评论