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
Ejemplo 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);
                    }
                }
            }
        }
Ejemplo n.º 2
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, _menuItem.Items, keyboardActivated);

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

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

                    // Should this menu item be shown at a fixed screen rectangle?
                    if (_provider.ProviderShowSubMenuFixed(_menuItem))
                    {
                        // Request the menu be shown at fixed screen rectangle
                        _contextMenu.ShowFixed(_provider.ProviderShowSubMenuFixedRect(_menuItem),
                                               _provider.ProviderShowHorz,
                                               _provider.ProviderShowVert);
                    }
                    else
                    {
                        // Request the menu be shown immediately
                        _contextMenu.Show(menuDrawRect,
                                          _provider.ProviderShowHorz,
                                          _provider.ProviderShowVert,
                                          true, false);
                    }
                }
            }
        }