Al Bundy Al Bundy - 1 year ago 65
C# Question

How can I distinguish if a menu is opened or closed in the ToolStripMenuItem EventHandler

Adding an event handler to a

like this:

foo = new ToolStripMenuItem( title, image, EVENT_HANDLER );

then the
is called when the menu has been clicked

  1. to open, or

  2. to close the menu item.

My question:

How can I distinguish in the
if the event was triggered because the menu is going to be closed?


I am not talking about

Answer Source

You probably won't be able to get that information from the Clicked event.

A work-around would be to use a variable for tracking the status and using the menu's DropDownOpening and DropDownClosed events to keep track of the open status of the menu.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download