Source/Controls/ReflectionLabel.cs

(开头部分) 15KB

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

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

namespace DevComponents.DotNetBar.Controls
{
    /// <summary>
    /// Represents an single line of text label control with text-markup support and built-in reflection.
    /// </summary>
    [ToolboxItem(true), Designer(typeof(Design.ReflectionLabelDesigner)), ToolboxBitmap(typeof(LabelX), "Controls.ReflectionLabel.ico")]
    public class ReflectionLabel : ControlWithBackgroundStyle
    {
        #region Private Variables
        private TextMarkup.BodyElement _TextMarkup = null;
        private Bitmap _ReflectionBitmap = null;
        private float _ReflectionFactor = .52f;
        private Size _TextSize = Size.Empty;
        #endregion

        #region Events
        /// <summary>
        /// Occurs when text markup link is clicked. Markup links can be created using "a" tag, for example:
        /// <a name="MyLink">Markup link</a>
        /// </summary>
        public event MarkupLinkClickEventHandler MarkupLinkClick;
        #endregion

        #region Constructor
        #endregion

        #region Internal Implementation
        protected override void Dispose(bool disposing)
        {
            DisposeReflectionImage();
            base.Dispose(disposing);
        }

        protected override void PaintContent(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            SmoothingMode sm = g.SmoothingMode;
            if (AntiAlias)
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                g.TextRenderingHint = DisplayHelp.AntiAliasTextRenderingHint;
            }

            Rectangle r = GetContentRectangle();
            Point reflectionLocation = r.Location;
            ElementStyle style = GetBackgroundStyle();
            if (_TextMarkup != null)
            {
                TextMarkup.MarkupDrawContext d = new TextMarkup.MarkupDrawContext(g, this.Font, (style.TextColor.IsEmpty?this.ForeColor:style.TextColor), 
                    (this.RightToLeft == RightToLeft.Yes), Rectangle.Empty, true);
                if (!this.Enabled)
                {
后面还有 359 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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