ComponentFactory.Krypton.Ribbon.ViewDrawRibbonDesignGroupContainer.OnClick C# (CSharp) Method

OnClick() protected method

Raises the Click event.
protected OnClick ( object sender, EventArgs e ) : void
sender object Source of the event.
e System.EventArgs An EventArgs containing the event data.
return void
        protected override void OnClick(object sender, EventArgs e)
        {
            // Create the context strip the first time around
            if (_cms == null)
            {
                _cms = new ContextMenuStrip();
                _cms.ImageList = _imageList;

                // Create child items
                ToolStripMenuItem menuTriple = new ToolStripMenuItem("Add Triple", null, new EventHandler(OnAddTriple));
                ToolStripMenuItem menuLines = new ToolStripMenuItem("Add Lines", null, new EventHandler(OnAddLines));
                ToolStripMenuItem menuSeparator = new ToolStripMenuItem("Add Separator", null, new EventHandler(OnAddSeparator));
                ToolStripMenuItem menuGallery = new ToolStripMenuItem("Add Gallery", null, new EventHandler(OnAddGallery));

                // Assign correct images
                menuTriple.ImageIndex = 0;
                menuLines.ImageIndex = 1;
                menuSeparator.ImageIndex = 2;
                menuGallery.ImageIndex = 3;

                // Finally, add all items to the strip
                _cms.Items.AddRange(new ToolStripItem[] { menuTriple, menuLines, menuSeparator, menuGallery });
            }

            if (CommonHelper.ValidContextMenuStrip(_cms))
            {
                // Find the screen area of this view item
                Rectangle screenRect = Ribbon.ViewRectangleToScreen(this);

                // Make sure the popup is shown in a compatible way with any popups
                VisualPopupManager.Singleton.ShowContextMenuStrip(_cms, new Point(screenRect.X, screenRect.Bottom));
            }
        }