G
Guest
I'm having a problem with accelerator keys (also sometimes refered to as
shortcut keys or mnemonics) on Winforms. To reproduce, simply do this:
1. create a new C# "Windows Application" project (I'm using VS2005)
2. Add a button to the form and change its default Text from "button1" to
"&button1"
Now run the app. Press the alt key on the keyboard and the keyboard cue is
displayed (the 'b' becomes underlined) as it should. Press the alt key again
and the
underline does not go away. You will also notice that pressing the 'b' key
fires the button's click event regardless of whether the alt key was ever
pressed, or whether the cue is visible.
Surely this isn't "by design" (Menus don't work this way! OS supplied
dialogs don't work this way!)
Any pertinent suggestions on how to work around this would be welcome. TIA
shortcut keys or mnemonics) on Winforms. To reproduce, simply do this:
1. create a new C# "Windows Application" project (I'm using VS2005)
2. Add a button to the form and change its default Text from "button1" to
"&button1"
Now run the app. Press the alt key on the keyboard and the keyboard cue is
displayed (the 'b' becomes underlined) as it should. Press the alt key again
and the
underline does not go away. You will also notice that pressing the 'b' key
fires the button's click event regardless of whether the alt key was ever
pressed, or whether the cue is visible.
Surely this isn't "by design" (Menus don't work this way! OS supplied
dialogs don't work this way!)
Any pertinent suggestions on how to work around this would be welcome. TIA