Source/TextMarkup/ExpandElement.cs

(开头部分) 7KB

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

using System;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;

#if AdvTree
namespace DevComponents.Tree.TextMarkup
#elif DOTNETBAR
namespace DevComponents.DotNetBar.TextMarkup
#endif
{
    internal class ExpandElement : MarkupElement
    {
        #region Internal Implementation
        private Size m_DefaultSize = new Size(5, 4);
        private eExpandDirection m_Direction = eExpandDirection.Default;

        public override void Measure(System.Drawing.Size availableSize, MarkupDrawContext d)
        {
            this.Bounds = new Rectangle(Point.Empty, m_DefaultSize);
        }

        protected override void ArrangeCore(System.Drawing.Rectangle finalRect, MarkupDrawContext d) { }

        public override void Render(MarkupDrawContext d)
        {
            Rectangle r = this.Bounds;
            r.Offset(d.Offset);

            if (!d.ClipRectangle.IsEmpty && !r.IntersectsWith(d.ClipRectangle))
                return;

            Graphics g = d.Graphics;
            Color color = d.CurrentForeColor;
            eExpandDirection direction = eExpandDirection.Bottom;
            if (m_Direction != eExpandDirection.Default)
                direction = m_Direction;

            #if DOTNETBAR
            if(d.ContextObject is ButtonItem)
            {
                if (m_Direction == eExpandDirection.Default)
                {
                    ButtonItem item = d.ContextObject as ButtonItem;
                    if (item.IsOnMenu)
                    {
                        direction = eExpandDirection.Right;
                        if (item.PopupSide == ePopupSide.Default && d.RightToLeft || item.PopupSide == ePopupSide.Left)
                            direction = eExpandDirection.Left;
                    }
                    else if (item.PopupSide == ePopupSide.Default)
                        direction = eExpandDirection.Bottom;
                    else if (item.PopupSide == ePopupSide.Left)
                        direction = eExpandDirection.Left;
                    else if (item.PopupSide == ePopupSide.Right)
                        direction = eExpandDirection.Right;
                    else if (item.PopupSide == ePopupSide.Bottom)
                        direction = eExpandDirection.Bottom;
                    else if (item.PopupSide == ePopupSide.Top)
后面还有 135 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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