Source/TextMarkup/HyperLink.cs

(开头部分) 6KB

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

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

#if AdvTree
namespace DevComponents.Tree.TextMarkup
#elif DOTNETBAR
namespace DevComponents.DotNetBar.TextMarkup
#endif
{
    internal class HyperLink : MarkupElement, IActiveMarkupElement
    {
        #region Private Variables
        private Color m_ForeColor = Color.Empty;
        private Color m_OldForeColor = Color.Empty;
        private string m_HRef = "";
        private string m_Name = "";
        private Cursor m_OldCursor = null;
        private bool m_IsMouseOver = false;
        private bool m_Visited = false;
        #endregion

        #region Internal Implementation
        public override void Measure(Size availableSize, MarkupDrawContext d)
        {
            this.Bounds = Rectangle.Empty;
            SetForeColor(d);
        }

        public override void Render(MarkupDrawContext d)
        {
            d.HyperLink = true;
            d.HyperlinkStyle = GetHyperlinkStyle();
            if (!d.HyperlinkStyle.BackColor.IsEmpty)
            {
                using (GraphicsPath gp = new GraphicsPath())
                {
                    MarkupElementCollection col = this.Parent.Elements;
                    int start = col.IndexOf(this) + 1;
                    for (int i = start; i < col.Count; i++)
                    {
                        MarkupElement elem = col[i];
                        if (!elem.Visible) continue;
                        if (elem is EndMarkupElement && ((EndMarkupElement)elem).StartElement == this)
                            break;
                        gp.AddRectangle(elem.RenderBounds);
                    }

                    using (SolidBrush brush = new SolidBrush(d.HyperlinkStyle.BackColor))
                        d.Graphics.FillPath(brush, gp);
                }
            }
            SetForeColor(d);
        }

        private HyperlinkStyle GetHyperlinkStyle()
        {
后面还有 159 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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