lixiaojun
2024-08-16 2779e00649911e53903b7ff15c55eae9cfda6333
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
namespace Yw.WinFrmUI.HydroL2d
{
    /// <summary>
    /// 管道
    /// </summary>
    public class Pipe : Link
    {
        /// <summary>
        /// 线色
        /// </summary>
        public Color? LineColor { get; set; }
 
        /// <summary>
        /// 线宽
        /// </summary>
        public float? LineWidth { get; set; }
 
        /// <summary>
        /// 绘制
        /// </summary>
        public override void Draw(Graphics g)
        {
            var fromCachePen = true;
            var pen = CacheHelper.PipeLinePen;
            if (this.LineColor.HasValue && this.LineWidth.HasValue)
            {
                pen = new Pen(this.LineColor.Value, this.LineWidth.Value);
                fromCachePen = false;
            }
            g.DrawLines(pen, this.Positions.ToArray());
            if (!fromCachePen)
            {
                pen.Dispose();
            }
        }
 
 
    }
}