⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rich_string_link.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Core
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;

    public class rich_string_link
    {
        public static List<string> _clickedURLs = new List<string>();
        private bool _linkClicked;
        private bool _mouseHover;
        private List<RectangleF> _posRects;
        private string _strUrl;

        public rich_string_link()
        {
            this._posRects = new List<RectangleF>();
            this._strUrl = "";
            this.Clear();
        }

        public rich_string_link(string strURL)
        {
            this._posRects = new List<RectangleF>();
            this._strUrl = "";
            this.Clear();
            this._strUrl = strURL;
        }

        public rich_string_link(RectangleF rect, string strURL, bool bChicked)
        {
            this._posRects = new List<RectangleF>();
            this._strUrl = "";
            this.Clear();
            this.PosRect = rect;
            this._strUrl = strURL;
            this._linkClicked = bChicked;
        }

        public void AddRect(RectangleF rect)
        {
            this._posRects.Add(rect);
        }

        public void Clear()
        {
            this._posRects.Clear();
            this._strUrl = "";
            this._linkClicked = false;
            this._mouseHover = false;
        }

        public void ClearRectOnly()
        {
            this._posRects.Clear();
        }

        public bool HitTest(Point pt)
        {
            if (this._posRects.get_Count() != 0)
            {
                List<RectangleF>.Enumerator enumerator = this._posRects.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        RectangleF rect = enumerator.get_Current();
                        if (this.PtInRect(pt, rect))
                        {
                            return true;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            return false;
        }

        public bool MouseHover(Point pt)
        {
            if (this.HitTest(pt))
            {
                this._mouseHover = true;
            }
            else
            {
                this._mouseHover = false;
            }
            return this._mouseHover;
        }

        private bool PtInRect(Point pt, RectangleF rect)
        {
            return (((pt.X >= rect.Left) && (pt.X <= rect.Right)) && ((pt.Y >= rect.Top) && (pt.Y <= rect.Bottom)));
        }

        public bool Clicked
        {
            get
            {
                for (int i = 0; i < _clickedURLs.get_Count(); i++)
                {
                    if (string.Equals(_clickedURLs.get_Item(i), this._strUrl))
                    {
                        return true;
                    }
                }
                return this._linkClicked;
            }
            set
            {
                this._linkClicked = value;
                if (this._linkClicked)
                {
                    int num = 0;
                    num = 0;
                    while (num < _clickedURLs.get_Count())
                    {
                        if (string.Equals(_clickedURLs.get_Item(num), this._strUrl))
                        {
                            break;
                        }
                        num++;
                    }
                    if (num >= _clickedURLs.get_Count())
                    {
                        _clickedURLs.Add(this._strUrl);
                    }
                }
            }
        }

        public RectangleF PosRect
        {
            get
            {
                if (this._posRects.get_Count() > 0)
                {
                    return this._posRects.get_Item(0);
                }
                return RectangleF.Empty;
            }
            set
            {
                this.AddRect(value);
            }
        }

        public List<RectangleF> PosRects
        {
            get
            {
                return this._posRects;
            }
            set
            {
                this._posRects.Clear();
                List<RectangleF>.Enumerator enumerator = value.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        RectangleF ef = enumerator.get_Current();
                        this._posRects.Add(ef);
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
        }

        public string URL
        {
            get
            {
                return this._strUrl;
            }
            set
            {
                this._strUrl = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -