Source/AdvTree/Display/DragDropMarkerDisplay.cs

(完整代码) 1KB

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

namespace DevComponents.AdvTree.Display
{
    internal class DragDropMarkerDisplay
    {
        public void DrawMarker(DragDropMarkerRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            Rectangle bounds = e.Bounds;
            if (bounds.IsEmpty || _MarkerColor.IsEmpty) return;

            using (SolidBrush brush = new SolidBrush(_MarkerColor))
            {
                using (Pen pen = new Pen(brush, 1))
                {
                    Point p = new Point(bounds.X, bounds.Y + 4);
                    g.DrawLine(pen, p.X, p.Y, bounds.Right - 1, p.Y);
                }

                using (GraphicsPath path = new GraphicsPath())
                {
                    path.AddLine(bounds.X, bounds.Y, bounds.X, bounds.Y + 8);
                    path.AddLine(bounds.X, bounds.Y + 8, bounds.X+4, bounds.Y+4);
                    path.CloseAllFigures();
                    g.FillPath(brush, path);
                }
                using (GraphicsPath path = new GraphicsPath())
                {
                    path.AddLine(bounds.Right, bounds.Y, bounds.Right, bounds.Y + 8);
                    path.AddLine(bounds.Right, bounds.Y + 8, bounds.Right - 4, bounds.Y + 4);
                    path.CloseAllFigures();
                    g.FillPath(brush, path);
                }
            }
            
        }

        private Color _MarkerColor;
        public Color MarkerColor
        {
            get { return _MarkerColor; }
            set { _MarkerColor = value; }
        }
    }
}

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

AI 解读 AI

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

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