private void SyncChildrenToRibbonTabs()
        {
            // Remove all child elements
            Clear();

            // Create a new lookup that reflects any changes in tabs
            TabToView regenerate = new TabToView();

            // Make sure we have a view element to match each tab
            foreach (KryptonRibbonTab tab in Ribbon.RibbonTabs)
            {
                ViewLayoutRibbonScrollPort view = null;

                // Get the currently cached view for the tab
                if (_tabToView.ContainsKey(tab))
                {
                    view = _tabToView[tab];
                }

                // If a new tab, create a view for it now
                if (view == null)
                {
                    ViewLayoutRibbonGroups groups = new ViewLayoutRibbonGroups(Ribbon, tab, NeedPaintDelegate);
                    view = new ViewLayoutRibbonScrollPort(Ribbon, Orientation.Horizontal, groups, false, SCROLL_SPEED, NeedPaintDelegate)
                    {
                        TransparentBackground = true
                    };
                    groups.NeedPaintDelegate = view.ViewControlPaintDelegate;
                }

                // Make sure only the selected tab is visible
                view.Visible = (Ribbon.SelectedTab == tab);

                // Add to the lookup for future reference
                regenerate.Add(tab, view);

                // Remove no longer needed reference
                _tabToView.Remove(tab);
            }

            // Switch to using the lookup with only the current options inside
            TabToView redundant = _tabToView;

            _tabToView = regenerate;

            // Add the view elements in same order as the tab definitions
            foreach (KryptonRibbonTab tab in Ribbon.RibbonTabs)
            {
                Add(_tabToView[tab]);
            }

            // Dispose of all the no longer needed child tabs
            foreach (ViewBase oldChild in redundant.Values)
            {
                oldChild.Dispose();
            }
        }
        /// <summary>
        /// Gets the view element group that the provided point is inside.
        /// </summary>
        /// <param name="pt">Mouse point.</param>
        /// <returns>Reference if inside a group; otherwise null.</returns>
        public ViewDrawRibbonGroup ViewGroupFromPoint(Point pt)
        {
            // There can only be groups showing for the currently selected tab
            if (Ribbon.SelectedTab != null && (_tabToView.ContainsKey(Ribbon.SelectedTab)))
            {
                // Get the scroll port for this tab
                ViewLayoutRibbonScrollPort viewScrollPort = _tabToView[Ribbon.SelectedTab];

                // The first child of the scroll port is always the view control
                ViewLayoutControl viewControl = viewScrollPort[0] as ViewLayoutControl;

                // The first child of the view control is always the ribbon groups
                ViewLayoutRibbonGroups viewGroups = viewControl.ChildView as ViewLayoutRibbonGroups;

                // Ask the view groups to find a matching group
                return(viewGroups.ViewGroupFromPoint(pt));
            }

            return(null);
        }