View element that draws nothing and takes up all given space.
Inheritance: ComponentFactory.Krypton.Toolkit.ViewLeaf
コード例 #1
0
        private void SyncChildrenToRibbonTabs()
        {
            // Remove all child elements
            Clear();

            // Make sure we have enough cached elements
            if (_tabCache.Count < _ribbon.RibbonTabs.Count)
            {
                for (int i = _tabCache.Count; i < _ribbon.RibbonTabs.Count; i++)
                {
                    _tabCache.Add(new ViewDrawRibbonTab(_ribbon, this, _needPaint));
                }
            }

            if (_tabSepCache.Count < _ribbon.RibbonTabs.Count)
            {
                for (int i = _tabSepCache.Count; i < _ribbon.RibbonTabs.Count; i++)
                {
                    _tabSepCache.Add(new ViewDrawRibbonTabSep(_ribbon.StateCommon.RibbonGeneral));
                }
            }

            // Update from ribbon control in same order as display
            UpdateContextNameCache();

            // Clear down the list of tab sets
            ContextTabSets.Clear();

            // Add all tabs that do not have a context name
            AddTabsWithContextName(string.Empty);

            // Add each set of tabs that match each listed selected context name
            foreach (string contextName in _cachedSelectedContext)
            {
                // Check that the context name actually is defined
                if (_ribbon.RibbonContexts[contextName] != null)
                {
                    AddTabsWithContextName(contextName);
                }
            }

            // When in design time help mode
            if (_ribbon.InDesignHelperMode)
            {
                // Create the design time 'Add Tab' first time it is needed
                if (_viewAddTab == null)
                {
                    _viewAddTab = new ViewDrawRibbonDesignTab(_ribbon, _needPaint);
                }

                // Always add at end of the list of tabs
                Add(_viewAddTab);
            }
            else
            {
                // At run time we add the filler that acts like title bar header
                if (_tabsSpare == null)
                {
                    _tabsSpare = new ViewLayoutRibbonTabsSpare();
                }

                // Always add at end of the list of tabs
                Add(_tabsSpare);
            }
        }