ComponentFactory.Krypton.Toolkit.MenuItemController.PressMenuItem C# (CSharp) Method

PressMenuItem() private method

private PressMenuItem ( ) : void
return void
        private void PressMenuItem()
        {
            // Should we automatically try and close the context menu stack
            if (_menuItem.KryptonContextMenuItem.AutoClose)
            {
                // 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.KryptonContextMenuItem.PerformClick();
            PerformNeedPaint(true);
        }