4

Noticed in a full application, but fully reproducable in a simple demo:

I've got a MenuStrip containing three menus, A, B, and C. Each of these menus contains three items, A1/A2/.../C2/C3.

When I press Alt, the first menu A becomes selected. I can then use the and keys to select other menus. That is as it should be.

However, when I press to open a menu, I can still use and to select other menus, but the order is reversed: selects the next menu, and the previous.

I'm having trouble figuring out if something is wrong with my local system, if this is a bug in the MenuStrip component, or if I am forgetting to set a required property. All three seem strange to me, because in all three cases I would expect someone to have encountered this problem already, and I cannot even find anyone else asking about this.

If it's not clear what I'm asking, here is an image:

Menu strip problem

And before I forget to mention, there is no relevant code. This demo application is a brand new WinForms project, has one MenuStrip control added to its default form, and has got three menus with three items each, for each of which I have set nothing more than the text.

Community
  • 1
  • 1
  • Not reproducible by me. B1 -> goes to C1 on my form. – LarsTech Apr 30 '13 at 17:21
  • Thanks for checking. I guess that probably rules out option three, so that leaves a combination of local system configuration / bug in `MenuStrip`. –  Apr 30 '13 at 17:26

1 Answers1

7

This is a bug/misfeature in MenuStrip.

Looking at the ToolStripDropDown.ProcessArrowKey implementation with Reflector shows that the arrow keys get reversed depending on SystemInformation.RightAlignedMenus. That's not right. It should depend on the right-to-left mode of the menu strip itself, which may sometimes (usually?) match SystemInformation.RightAlignedMenus, but not always, and not on my system.

SystemInformation.RightAlignedMenus is user-configurable via Control Panel, Tablet PC Settings, Other, Handedness, and indeed if I change that to Left-handed, I get the menus to behave correctly. The default and correct setting for me is Right-handed. Since the MenuStrip component is simply not keyboard-usable on my system, I will replace my use of it with a standard MainMenu component.

Update: I'm actually using a derived control to be able to provide nice menu images. It is based on the Microsoft sample on "Visual Style Menus". A more fully-featured implementation that also works on Windows XP and prior (in that case using owner-drawn menus) is available at Vista Menu with Icons in C#, but that is more complicated than necessary for me.

  • Thank you for this. I just spent the last few hours puzzling over this problem. I can't believe that more than a year later, this bug still hasn't been fixed. – Jason Lim Dec 05 '14 at 01:56
  • The current way I found to change this system setting (as of windows 10) is to Win+R `explorer shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E}` -> 'Other' tab – Taran Apr 08 '20 at 07:06