ComponentFactory.Krypton.Toolkit.ViewDrawMenuLinkLabel.Close C# (CSharp) Method

Close() public method

Raises the Close event on the provider.
public Close ( CloseReasonEventArgs e ) : void
e CloseReasonEventArgs A CancelEventArgs containing the event data.
return void
        public void Close(CloseReasonEventArgs e)
        {
            _provider.OnClose(e);
        }

Usage Example

Esempio n. 1
0
        private void PressMenuLinkLabel(bool keyboard)
        {
            if (keyboard)
            {
                _target.ElementState   = PaletteState.Pressed;
                _menuLinkLabel.Pressed = true;
                PerformNeedPaint();
                Application.DoEvents();
            }

            // Should we automatically try and close the context menu stack
            if (_menuLinkLabel.KryptonContextMenuLinkLabel.AutoClose)
            {
                // Is the menu capable of being closed?
                if (_menuLinkLabel.CanCloseMenu)
                {
                    // Ask the original context menu definition, if we can close
                    CancelEventArgs cea = new CancelEventArgs();
                    _menuLinkLabel.Closing(cea);

                    if (!cea.Cancel)
                    {
                        // Close the menu from display and pass in the item clicked as the reason
                        _menuLinkLabel.Close(new CloseReasonEventArgs(ToolStripDropDownCloseReason.ItemClicked));
                    }
                }
            }

            if (Click != null)
            {
                Click(this, EventArgs.Empty);
            }

            if (keyboard)
            {
                UpdateTarget();
                PerformNeedPaint();
            }
        }