How to fix weird scrolling/alignment behavior when using keyboard in MenuStrip?

Posted by bentsai on Stack Overflow See other posts from Stack Overflow or by bentsai
Published on 2010-04-09T16:08:02Z Indexed on 2010/04/09 16:33 UTC
Read the original article Hit count: 395

Filed under:
|
|
|

I started noticing strange behavior when navigating the main toolbar of my Winforms application, and I don't know how to fix it. When I initially open the dropdown of the File menu, it looks like this:

normal

I begin to scroll down each item with the arrow keys, and everything is fine until I reach "Exit". As soon as I hit the down arrow key from "Log Off", or if I hit the up arrow key from "Open", the menu rearranges itself to look like this:

alt text

I'm puzzled by this behavior. The menu still works, and from this point, if I start scrolling up, I can get the arrangement back to normal:

alt text

A few observations:

  • The menu still works.
  • This doesn't happen when using the mouse.
  • I have some code that toggles the Visible property of some of the menu items. I was able to modify what the arrangement was by playing around with this, but it was still messed up.

Can anyone help me understand what is going on, and how to fix it?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about .NET