ComponentFactory.Krypton.Ribbon.CalculatedValues.Recalculate C# (CSharp) Method

Recalculate() public method

Recalculate all the values.
public Recalculate ( ) : void
return void
        public void Recalculate()
        {
            // Do we need to update the shape dependant values?
            if (_lastShape != _ribbon.RibbonShape)
            {
                _lastShape = _ribbon.RibbonShape;
                switch (_lastShape)
                {
                    default:
                    case PaletteRibbonShape.Office2007:
                        _groupHeightModifier = 0;
                        _groupsHeightModifier = 0;
                        break;
                    case PaletteRibbonShape.Office2010:
                        _groupHeightModifier = -3;
                        _groupsHeightModifier = -3;
                        break;
                }
            }

            // Get the font used by the ribbon
            Font font = _ribbon.StateCommon.RibbonGeneral.GetRibbonTextFont(PaletteState.Normal);

            // Cache common font height related values
            _rawFontHeight = font.Height;

            _drawFontHeight = _rawFontHeight + FONT_HEIGHT_EXTRA;

            // Height of all tabs in the tabs area
            _tabHeight = _drawFontHeight + TABS_TOP_GAP;

            // Find the height of the group title area (must be minimum size to show the dialog launcher button)
            _groupTitleHeight = Math.Max(_drawFontHeight, DIALOG_MIN_HEIGHT);

            // Get the height needed for showing the content of a group line
            _groupLineContentHeight = Math.Max(_drawFontHeight, GROUP_LINE_CONTENT_MIN);

            // Group line height must be the content plus spacing gap and then border
            _groupLineHeight = _groupLineContentHeight + GROUP_LINE_CONTENT_EXTRA;

            // Group inside height is 3 group lines plus space at bottom of the lines
            _groupTripleHeight = (_groupLineHeight * 3);

            // The gap between lines is one of the lines divide by a gap above, between and below lines
            _groupLineGapHeight = (_groupLineHeight / 3);

            // Group height is the inside plus title area at bottom and the top border
            _groupHeight = _groupTripleHeight + GROUP_INSIDE_BOTTOM_GAP + _groupTitleHeight + GROUP_TOP_BORDER;

            // Size of the groups area (not including the top pixel that is placed in the tabs
            // area is the height of a group plus the bottom and top gaps).
            _groupsHeight = _groupHeight + GROUPS_BOTTOM_GAP + GROUPS_TOP_GAP;

            // Apply shape specific modifiers
            _groupHeight += _groupHeightModifier;
            _groupsHeight += _groupsHeightModifier;
        }