private void PressMenuItem()
{
// Is the menu capable of being closed?
if (_menuItem.CanCloseMenu)
{
// Ask the original context menu definition, if we can close
CancelEventArgs cea = new CancelEventArgs();
_menuItem.Closing(cea);
if (!cea.Cancel)
{
// Close the menu from display and pass in the item clicked as the reason
_menuItem.Close(new CloseReasonEventArgs(ToolStripDropDownCloseReason.ItemClicked));
}
}
// Generate a click event for the menu item
_menuItem.RecentDoc.PerformClick();
PerformNeedPaint(true);
}