ComponentFactory.Krypton.Toolkit.VisualContextMenu.ShowFixed C# (CSharp) Method

ShowFixed() public method

Show the context menu at the fixed screen rectangle.
public ShowFixed ( Rectangle screenRect, KryptonContextMenuPositionH horz, KryptonContextMenuPositionV vert ) : void
screenRect System.Drawing.Rectangle Screen rectangle.
horz KryptonContextMenuPositionH Horizontal location relative to screen rectangle.
vert KryptonContextMenuPositionV Vertical location relative to screen rectangle.
return void
        public void ShowFixed(Rectangle screenRect,
                              KryptonContextMenuPositionH horz,
                              KryptonContextMenuPositionV vert)
        {
            // Cache the information used to create this menu
            ShowHorz = horz;
            ShowVert = vert;

            // Call base class method that performs actual sizing and display of control
            base.Show(screenRect);
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Ask the menu item to show the associated child collection as a menu.
        /// </summary>
        public void ShowSubMenu(bool keyboardActivated)
        {
            // Only need to show if not already doing so
            if ((_contextMenu == null) || (_contextMenu.IsDisposed))
            {
                // No need for the sub menu timer anymore, we are showing
                _provider.ProviderViewManager.SetTargetSubMenu((IContextMenuTarget)KeyController);

                // Only show a sub menu if there is one to be shown!
                if (HasSubMenu)
                {
                    // Create the actual control used to show the context menu
                    _contextMenu = new VisualContextMenu(_provider, KryptonContextMenuItem.Items, keyboardActivated);

                    // Need to know when the visual control is removed
                    _contextMenu.Disposed += OnContextMenuDisposed;

                    // Get the screen rectangle for the drawing element
                    Rectangle menuDrawRect = OwningControl.RectangleToScreen(ClientRectangle);

                    // Should this menu item be shown at a fixed screen rectangle?
                    if (_provider.ProviderShowSubMenuFixed(KryptonContextMenuItem))
                    {
                        // Request the menu be shown at fixed screen rectangle
                        _contextMenu.ShowFixed(_provider.ProviderShowSubMenuFixedRect(KryptonContextMenuItem),
                                               _provider.ProviderShowHorz,
                                               _provider.ProviderShowVert);
                    }
                    else
                    {
                        // Request the menu be shown immediately
                        _contextMenu.Show(menuDrawRect,
                                          _provider.ProviderShowHorz,
                                          _provider.ProviderShowVert,
                                          true, false);
                    }
                }
            }
        }
All Usage Examples Of ComponentFactory.Krypton.Toolkit.VisualContextMenu::ShowFixed