Source/Ribbon/CaptionItemContainer.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.Drawing;

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Defines container for ribbon caption layout and quick access toolbar customization and overflow.
    /// </summary>
    internal class CaptionItemContainer : GenericItemContainer
    {
        #region Private Variables
        private int m_MinTitleSize = 40;
        private int m_MoreItemsLeft = 0;
        private CustomizeItem m_CustomizeItem = null;
        private int m_MaxHeight = 0;
        #endregion

        #region Constructor
        public CaptionItemContainer():base()
        {
            this.FirstItemSpacing = 3;
            this.ToolbarItemsAlign = eContainerVerticalAlignment.Top;
        }
        #endregion

        #region Layout
        public override void RecalcSize()
        {
            if (m_MoreItems != null && m_MoreItems.Expanded)
                m_MoreItems.Expanded = false;

            m_RecalculatingSize = true;
            int width = m_MinTitleSize;
            if (this.ContainerControl is Ribbon.QatToolbar)
                width = 0;
            int count = this.SubItems.Count;
            int firstFarIndex = -1;
            int maxHeight = 0;
            int maxItemHeight = 0;
            int moreItemsHeight = 22;
            bool hasQatCustomizeItem = false;
            for (int i = 0; i < count; i++)
            {
                BaseItem item = this.SubItems[i];
                if (!item.Visible)
                    continue;
                item.RecalcSize();
                item.Displayed = true;
                width += (item.WidthInternal + (i==0?this.FirstItemSpacing:m_ItemSpacing));
                
                if (item.ItemAlignment == eItemAlignment.Far && firstFarIndex == -1)
                    firstFarIndex = i;
                if (firstFarIndex == -1)
                    moreItemsHeight = item.HeightInternal;

                if (item.HeightInternal > maxHeight)
                    maxHeight = item.HeightInternal;
                if (item.HeightInternal > maxItemHeight && !(item is Office2007StartButton || item is SystemCaptionItem))
                    maxItemHeight = item.HeightInternal;
后面还有 202 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。