Typically the hotkey letters on a MenuStrip are underlined. (&File, &Open, etc) On a project I'm working on the underline shows up in the designer, but not at run time. I can't find the property that controls this. Anyone out there know?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Should I use static function in c# where many call
For the follow-up question related to this, namely, getting this to work for all your applications hotkeys:
Call GetAltKeyFixed prior to the Application.Run or equiv.
I needed this for 508 compliance and almost all answers on this subject are to change the Desktop settings Or a terse "why would you want to do that?" response. This is not the craziest requirement I've heard off.
They will only show up at runtime when the user presses the alt key. When you press the alt key the form thinks you might want to use one of the shortcuts so it displays any of the underlining.
In Windows, there is a setting whether or not to show the underline. To change the setting,
You can force the user to see the underline by creating a custom ToolStrip renderer. It took me quite a while to figure out how to bypass Chris's answer. Here is the renderer I created:
And then in the Form with the MenuStrip, in the constructor you set the renderer:
I would like to note that if you prefer a System style look of renderering you can extend the ToolStripSystemRenderer class instead of the Professional but I like being able to customize the color table. This is the fix that doesn't require the client to change his computer settings. Enjoy!