Source/Ribbon/Office2007ItemContainerPainter.cs

(开头部分) 7KB

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

using System;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using DevComponents.DotNetBar.Rendering;

namespace DevComponents.DotNetBar
{
    internal class Office2007ItemContainerPainter : ItemContainerPainter, IOffice2007Painter
    {
        #region IOffice2007Painter
        private Office2007ColorTable m_ColorTable = null; //new Office2007ColorTable();
        /// <summary>
        /// Gets or sets color table used by renderer.
        /// </summary>
        public Office2007ColorTable ColorTable
        {
            get { return m_ColorTable; }
            set { m_ColorTable = value; }
        }
        #endregion

        #region PaintBackground
        public override void PaintBackground(ItemContainerRendererEventArgs e)
        {
            if (!BarFunctions.IsOffice2007Style(e.ItemContainer.Style))
                return;

            ItemContainer container = e.ItemContainer;
            Office2007ItemGroupColorTable gt = m_ColorTable.ItemGroup;

            if (container.SubItems.Count == 0 || gt == null)
                return;

            Rectangle bounds = container.DisplayRectangle;

            if (!container.BeginGroup || container.IsOnMenu && !(container.Parent is ItemContainer))
            {
                if (container.BackgroundStyle.Class == ElementStyleClassKeys.Office2007StatusBarBackground2Key && e.ItemPaintArgs != null &&
                e.ItemPaintArgs.ContainerControl is Bar && ((Bar)e.ItemPaintArgs.ContainerControl).BarType == eBarType.StatusBar)
                {                    
                    bounds.Y = 1;
                    bounds.Height = e.ItemPaintArgs.ContainerControl.Height - 1;
                    if (container.Parent.SubItems.IndexOf(container) == container.Parent.SubItems.Count - 1)
                    {
                        if (e.ItemPaintArgs.RightToLeft)
                        {
                            bounds.Width += bounds.X;
                            bounds.X = 0;
                        }
                        else
                        {
                            bounds.Width += e.ItemPaintArgs.ContainerControl.Width - bounds.Right;
                        }
                    }
                }
                Region oldClip = e.Graphics.Clip;
                e.Graphics.SetClip(bounds);
                ElementStyleDisplay.Paint(new ElementStyleDisplayInfo(container.BackgroundStyle, e.Graphics, bounds));
                e.Graphics.Clip = oldClip;
后面还有 124 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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