ComponentFactory.Krypton.Toolkit.ViewDrawMenuItem.PointInSubMenu C# (CSharp) Method

PointInSubMenu() public method

Indicates whether the mouse point should show a sub menu.
public PointInSubMenu ( Point pt ) : bool
pt Point
return bool
        public bool PointInSubMenu(Point pt)
        {
            // Do we have sub menu items defined?
            if (HasSubMenu)
            {
                // If menu item is split into regular button and sub menu areas
                if (_splitSeparator.Draw)
                {
                    // If mouse is inside or to the right of the slip indicator,
                    // then a sub menu is required when the button is used
                    return (pt.X > _splitSeparator.ClientRectangle.X);
                }

                // Whole item is the sub menu area
                return true;
            }

            return false;
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Should a mouse down at the provided point cause the currently stacked context menu to become current.
        /// </summary>
        /// <param name="pt">Client coordinates point.</param>
        /// <returns>True to become current; otherwise false.</returns>
        public bool DoesStackedClientMouseDownBecomeCurrent(Point pt)
        {
            // If the item is enabled and the mouse is over the sub menu area, then return false
            // because we do not want pressed it to cause the context menu to become current. This
            // cause the showing sub menu to be dismissed.
            if (_menuItem.ItemEnabled)
            {
                return(!_menuItem.PointInSubMenu(pt));
            }

            return(true);
        }