public void Close (ToolStripDropDownCloseReason reason)
{
if (!this.Visible)
return;
// Give users a chance to cancel the close
ToolStripDropDownClosingEventArgs e = new ToolStripDropDownClosingEventArgs (reason);
this.OnClosing (e);
if (e.Cancel)
return;
// Don't actually close if AutoClose == true unless explicitly called
if (!this.auto_close && reason != ToolStripDropDownCloseReason.CloseCalled)
return;
// Detach from the tracker
ToolStripManager.AppClicked -= new EventHandler (ToolStripMenuTracker_AppClicked); ;
ToolStripManager.AppFocusChange -= new EventHandler (ToolStripMenuTracker_AppFocusChange);
// Hide this dropdown
this.Hide ();
// Owner MenuItem needs to be told to redraw (it's no longer selected)
if (owner_item != null)
owner_item.Invalidate ();
// Recursive hide all child dropdowns
foreach (ToolStripItem tsi in this.Items)
tsi.Dismiss (reason);
this.OnClosed (new ToolStripDropDownClosedEventArgs (reason));
}