Source/CheckBoxItem/Office2007CheckBoxItemPainter.cs

(开头部分) 15KB

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

using System;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace DevComponents.DotNetBar.Rendering
{
    internal class Office2007CheckBoxItemPainter: CheckBoxItemPainter, IOffice2007Painter
    {
        #region Private Variables
        
        #endregion

        #region IOffice2007Painter
        private Office2007ColorTable m_ColorTable = null;

        /// <summary>
        /// Gets or sets color table used by renderer.
        /// </summary>
        public Office2007ColorTable ColorTable
        {
            get { return m_ColorTable; }
            set { m_ColorTable = value; }
        }
        #endregion

        #region Internal Implementation
        public override void Paint(CheckBoxItemRenderEventArgs e)
        {
            Graphics g = e.Graphics;
            CheckBoxItem item = e.CheckBoxItem;
            bool rtl = e.RightToLeft;
            Font font = e.Font;
            Office2007CheckBoxStateColorTable ct = this.GetCheckBoxStateColorTable(e);

            Rectangle checkBoxPosition = Rectangle.Empty;
            Rectangle textRect = Rectangle.Empty;
            eTextFormat tf = eTextFormat.Default;

            if (item.CheckBoxPosition == eCheckBoxPosition.Left && !rtl || item.CheckBoxPosition == eCheckBoxPosition.Right && rtl)
            {
                checkBoxPosition = new Rectangle(item.DisplayRectangle.X + item.CheckTextSpacing / 2,
                    item.DisplayRectangle.Y + (item.DisplayRectangle.Height - item.CheckSignSize.Height) / 2,
                    item.CheckSignSize.Width, item.CheckSignSize.Height);
                textRect = new Rectangle(checkBoxPosition.Right + item.CheckTextSpacing / 2, item.DisplayRectangle.Y,
                    item.DisplayRectangle.Right - (checkBoxPosition.Right + item.CheckTextSpacing / 2), item.DisplayRectangle.Height);
                if (item.TextMarkupBody == null)
                    textRect.Height = checkBoxPosition.Height + checkBoxPosition.Y - item.DisplayRectangle.Y + font.FontFamily.GetCellAscent(font.Style) / font.FontFamily.GetEmHeight(font.Style);
                
                tf |= eTextFormat.Bottom;
            }
            else if (item.CheckBoxPosition == eCheckBoxPosition.Right && !rtl || item.CheckBoxPosition == eCheckBoxPosition.Left && rtl)
            {
                checkBoxPosition = new Rectangle(item.DisplayRectangle.Right - item.CheckTextSpacing / 2 - item.CheckSignSize.Width,
                    item.DisplayRectangle.Y + (item.DisplayRectangle.Height - item.CheckSignSize.Height) / 2,
                    item.CheckSignSize.Width, item.CheckSignSize.Height);
                textRect = new Rectangle(item.DisplayRectangle.X, item.DisplayRectangle.Y,
                    checkBoxPosition.X - (item.DisplayRectangle.X + item.CheckTextSpacing / 2), item.DisplayRectangle.Height);
                if (item.TextMarkupBody == null)
后面还有 268 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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