Roberto D V Leonardo
Roberto D V Leonardo

Reputation: 69

Prevent ToolStripMenu to "reopen" when keeping Alt key for long

Maybe this is a dumb question, but I never noticed. Since I'm creating a skin for my WinForm I have to manage the behavior and events of the strip menus. So I'm handling the selection in many ways (to handle the color of the elements) and I discovered that a menu is closed by pressing Alt only if you briefly press it.

If you keep it pressed long enough, the menu highlights (to open) again the first item in the menu. Do you happen to know how long that time would be? Because I'm handling events and my take is "if the menu is open, you press and then release Alt key, then the menu is closed" but it is not the case if you press it and release it much later so I have to handle this, possibly not in a dumb way, like "guessing"...?

I can handle the event maybe with a timer if I know how long that is, like, count time with the tick event and if Alt is kept pressed for long enough then I consider the menu "still open", like a boolean true, otherwise it's false. But for that, I should in fact know the duration needed.

Upvotes: 0

Views: 119

Answers (0)

Related Questions