tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
 
namespace WinCustControls
{
    public partial class UCPipe : UserControl
    {
        public UCPipe()
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);//忽略窗口消息,减少闪烁
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);//绘制到缓冲区,减少闪烁
            SetStyle(ControlStyles.UserPaint, true);//控件由其自身而不是操作系统绘制
            SetStyle(ControlStyles.ResizeRedraw, true);//控件调整其大小时重绘
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);//支持透明背景
            SizeChanged += UCPipe_SizeChanged;
            this.Size = new Size(200, 30);
            timer = new System.Timers.Timer();
            timer.Interval = 100;
            timer.AutoReset = true;
            timer.Elapsed += Timer_Elapsed;
        }
 
        private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            intLineLeft += 2;
            if (intLineLeft > 12)
            {
                intLineLeft = 0;
            }
            Invalidate();
        }
 
        System.Timers.Timer timer = null;
        int intLineLeft = 0;//线的左边距离
        int intPenWidth = 0;//圆弧的半径
        private void UCPipe_SizeChanged(object sender, EventArgs e)
        {
            intPenWidth = pipeStyle.ToString().Substring(0, 1) == "H" ? Height : Width;
        }
 
 
        private PipeStyle pipeStyle = PipeStyle.Horizontal_None_None;
        [DefaultValue(typeof(PipeStyle), "Horizontal_None_None"), Description("管道样式")]
        public PipeStyle PipeStyle
        {
            get { return pipeStyle; }
            set
            {
                string oldStr = pipeStyle.ToString().Substring(0, 1);
                string newStr = value.ToString().Substring(0, 1);
                pipeStyle = value;
                if (oldStr != newStr)
                {
                    Size = new Size(Size.Height, Size.Width);
                }
                Invalidate();
            }
        }
 
        private bool isFlow = false;
        [DefaultValue(typeof(bool), "False"), Description("是否流动")]
        public bool IsFlow
        {
            get { return isFlow; }
            set
            {
                isFlow = value;
                if (isFlow)
                {
                    timer.Start();
                }
                else
                {
                    timer.Stop();
                }
                Invalidate();
            }
        }
 
        private int flowWidth = 4;
        [DefaultValue(typeof(int), "4"), Description("流动线的粗细")]
        public int FlowWidth
        {
            get { return flowWidth; }
            set
            {
                flowWidth = value;
                if (flowWidth <= 0)
                    return;
                Invalidate();
            }
        }
 
        private int flowLength = 8;
        [DefaultValue(typeof(int), "4"), Description("流动线的长度")]
        public int FlowLength
        {
            get { return flowLength; }
            set
            {
                flowLength = value;
                Invalidate();
            }
        }
 
        private int flowSpace = 6;
        [DefaultValue(typeof(int), "6"), Description("流动线的间隔")]
        public int FlowSpace
        {
            get { return flowSpace; }
            set
            {
                flowSpace = value;
                Invalidate();
            }
        }
 
        private Color pipeColor = Color.LightBlue;
        [DefaultValue(typeof(Color), "LightBlue"), Description("管道的颜色")]
        public Color PipeColor
        {
            get { return pipeColor; }
            set
            {
                pipeColor = value;
                Invalidate();
            }
        }
 
        private Color flowColor = Color.White;
        [DefaultValue(typeof(Color), "White"), Description("流动线的颜色")]
        public Color FlowColor
        {
            get { return flowColor; }
            set
            {
                flowColor = value;
                Invalidate();
            }
        }
 
        private FlowDirection flowDirection = FlowDirection.Forward;
        [DefaultValue(typeof(FlowDirection), "Forward"), Description("流动的方向")]
        public FlowDirection FlowDirection
        {
            get { return flowDirection; }
            set
            {
                flowDirection = value;
                Invalidate();
            }
        }
 
        private int flowSpeed = 100;
        [DefaultValue(typeof(int), "100"), Description("流动速度")]
        public int FlowSpeed
        {
            get { return flowSpeed; }
            set
            {
                if (value <= 0)
                    return;
                flowSpeed = value;
                timer.Interval = flowSpeed;
                Invalidate();
            }
        }
 
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //管道轮廓路径 
            GraphicsPath path = new GraphicsPath();
            //流动线外围的路径
            GraphicsPath linePath = new GraphicsPath();
            switch (pipeStyle)
            {
                case PipeStyle.Horizontal_None_None://水平
                    path.AddLines(new PointF[] {
                        new PointF(0,0),
                        new PointF(ClientRectangle.Right,0),
                        new PointF(ClientRectangle.Right,Height),
                        new PointF(0,Height)
                    });
                    path.CloseAllFigures();//闭合
                    //添加中间流动线路径 
                    linePath.AddLine(0, Height / 2, Width, Height / 2);
                    break;
                case PipeStyle.Horizontal_Up_None://水平左上弯
                    path.AddLines(new PointF[]
                    {
                        new PointF(0, 0),
                        new PointF(this.ClientRectangle.Right, 0),
                        new PointF(this.ClientRectangle.Right, this.Height),
                        new PointF(0+intPenWidth, this.Height)//左下角点  下边直线弯道前的点 
                    });
                    //添加上弯弧线  所在圆的矩形左上角y:intPenWidth * -1
                    path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.CloseAllFigures();//闭合
                    //添加中间流动线  左边圆弧+右边直线
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
                    //右边直线
                    linePath.AddLine(intPenWidth, this.Height / 2, this.Width, this.Height / 2);
                    break;
                case PipeStyle.Horizontal_Down_None://水平左下弯
                    path.AddLines(new PointF[]
                    {
                        new PointF(intPenWidth, 0),//上边横线的起点
                        new PointF(this.ClientRectangle.Right, 0),//右上角点
                        new PointF(this.ClientRectangle.Right, this.Height),//右下角点
                        new PointF(0, this.Height)//左下角点
                    });
                    //左上角圆弧  向上旋转90度
                    path.AddArc(new Rectangle(0, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();//闭合
                    //添加流动线向上旋转弧
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
                    //流动线 向右直线
                    linePath.AddLine(intPenWidth + 1, this.Height / 2, this.Width, this.Height / 2);
                    break;
                case PipeStyle.Horizontal_None_Up://水平右上弯
                    path.AddLines(new PointF[]
                    {
                        //右下角直线起点(右边就是向下旋转弧)
                        new PointF(this.ClientRectangle.Right-intPenWidth, this.Height),
                        //左下角点
                        new PointF(0, this.Height),
                        //左上角点
                        new PointF(0, 0),
                        //右上角点
                        new PointF(this.ClientRectangle.Right, 0)
                    });
                    //添加右下角弧线
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    path.CloseAllFigures();
                    //添加中间流动线
                    linePath.AddLine(0, this.Height / 2, this.Width - intPenWidth, this.Height / 2);
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
                    break;
                case PipeStyle.Horizontal_None_Down://水平右下弯
                    path.AddLines(new PointF[]
                    {
                        new PointF(this.ClientRectangle.Right, this.Height),//右下角点
                        new PointF(0, this.Height),//右下角点
                        new PointF(0, 0),//左上角点
                        new PointF(this.ClientRectangle.Right-intPenWidth, 0)//右上角点(右边是向下圆弧)
                    });
                    //添加右上角弧线
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    path.CloseAllFigures();
                    //添加流动线+弧线
                    linePath.AddLine(0, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
                    break;
                case PipeStyle.Horizontal_Down_Up://水平左下右上
                    //添加上边直线(去掉弧线部分)
                    path.AddLine(new Point(intPenWidth, 0), new Point(this.Width, 0));
                    //添加右下角弧线
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    //添加下线直线
                    path.AddLine(new Point(this.Width - intPenWidth, this.Height), new Point(0, this.Height));
                    //添加左上角弧线
                    path.AddArc(new Rectangle(0, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();
                    //添加流动线圆弧 左上
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
                    //添加流动线圆弧 右下
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
                    break;
                case PipeStyle.Horizontal_Up_Down://左上右下
                    //添加上直线
                    path.AddLine(new Point(0, 0), new Point(this.Width - intPenWidth, 0));
                    //右上圆弧
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    //添加下直线
                    path.AddLine(new Point(this.Width, this.Height), new Point(intPenWidth, this.Height));
                    //添加左下圆弧
                    path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.CloseAllFigures();
                    //流动线 添加圆弧 左上
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
                    //流动线 中间直接
                    linePath.AddLine(intPenWidth, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
                    //流动线 右下圆弧
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
                    break;
                case PipeStyle.Horizontal_Up_Up://左上右上
                    //上边直线
                    path.AddLine(new Point(0, 0), new Point(this.Width, 0));
                    //右下圆弧
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    //下边直线
                    path.AddLine(new Point(this.Width - intPenWidth, this.Height), new Point(intPenWidth, this.Height));
                    //左上圆弧
                    path.AddArc(new Rectangle(0, intPenWidth * -1, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.CloseAllFigures();
                    //添加流动线右下圆弧
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
                    //添加流动线左下圆弧
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, -1 * intPenWidth / 2 - 1, intPenWidth, intPenWidth), 91, -91);
                    //添加左下圆弧
                    break;
                case PipeStyle.Horizontal_Down_Down://水平左下右下
                    //上边直线
                    path.AddLine(new Point(intPenWidth, 0), new Point(this.Width - intPenWidth, 0));
                    //右上角圆弧
                    path.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth * 2, -1, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    //下边线
                    path.AddLine(new Point(this.Width, this.Height), new Point(0, this.Height));
                    //左上角圆弧
                    path.AddArc(new Rectangle(0, -1, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();
                    //添加流动线 左上角圆弧
                    linePath.AddArc(new Rectangle(intPenWidth / 2 + 1, this.Height / 2, intPenWidth, intPenWidth), 179, 91);
                    //中间直线
                    linePath.AddLine(intPenWidth + 1, this.Height / 2, this.Width - intPenWidth - 1, this.Height / 2);
                    //右上角圆弧
                    linePath.AddArc(new Rectangle(this.ClientRectangle.Right - intPenWidth - intPenWidth / 2 - 1, intPenWidth / 2, intPenWidth, intPenWidth), 269, 91);
                    break;
 
                case PipeStyle.Vertical_None_None:
                    path.AddLines(new PointF[]
                    {
                        new PointF(0, 0),
                        new PointF(this.ClientRectangle.Right, 0),
                        new PointF(this.ClientRectangle.Right, this.Height),
                        new PointF(0, this.Height)
                    });
                    path.CloseAllFigures();
                    linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height);
                    break;
                case PipeStyle.Vertical_Left_None:
                    path.AddLines(new PointF[]
                    {
                        new PointF(this.ClientRectangle.Right, intPenWidth),
                        new PointF(this.ClientRectangle.Right, this.Height),
                        new PointF(0, this.Height),
                        new PointF(0, 0)
                    });
                    path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
                    linePath.AddLine(intPenWidth / 2, intPenWidth, intPenWidth / 2, this.Height);
                    break;
                case PipeStyle.Vertical_Right_None:
                    path.AddLines(new PointF[]
                    {
                        new PointF(this.ClientRectangle.Right, 0),
                        new PointF(this.ClientRectangle.Right, this.Height),
                        new PointF(0, this.Height),
                        new PointF(0, intPenWidth)
                    });
                    path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
                    linePath.AddLine(intPenWidth / 2, intPenWidth + 1, intPenWidth / 2, this.Height);
                    break;
                case PipeStyle.Vertical_None_Left:
                    path.AddLines(new PointF[]
                    {
                        new PointF(0, this.Height),
                        new PointF(0, 0),
                        new PointF(this.ClientRectangle.Right, 0),
                        new PointF(this.ClientRectangle.Right, this.Height-intPenWidth),
                    });
                    path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    path.CloseAllFigures();
 
                    linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height - intPenWidth);
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
                    break;
                case PipeStyle.Vertical_None_Right:
                    path.AddLines(new PointF[]
                    {
                        new PointF(0, this.Height-intPenWidth),
                        new PointF(0, 0),
                        new PointF(this.ClientRectangle.Right, 0),
                        new PointF(this.ClientRectangle.Right, this.Height),
                    });
                    path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.CloseAllFigures();
 
                    linePath.AddLine(this.Width / 2, 0, this.Width / 2, this.Height - intPenWidth - 1);
                    linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
                    break;
                case PipeStyle.Vertical_Left_Right:
                    path.AddLine(this.Width, intPenWidth, this.Width, this.Height);
                    path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.AddLine(0, this.Height - intPenWidth, 0, 0);
                    path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
                    linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 181, -91);
                    break;
                case PipeStyle.Vertical_Right_Left:
                    path.AddLine(this.Width, 0, this.Width, this.Height - intPenWidth);
                    path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    path.AddLine(0, this.Height, 0, intPenWidth);
                    path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
                    break;
                case PipeStyle.Vertical_Left_Left:
                    path.AddLine(this.Width, intPenWidth, this.Width, this.Height - intPenWidth);
                    path.AddArc(new Rectangle(-1 * intPenWidth, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 0, 90);
                    path.AddLine(0, this.Height, 0, 0);
                    path.AddArc(new Rectangle(-1 * intPenWidth, 0, intPenWidth * 2, intPenWidth * 2), 270, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 269, 91);
                    linePath.AddArc(new Rectangle(-1 * intPenWidth / 2 - 1, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), -1, 91);
                    break;
                case PipeStyle.Vertical_Right_Right:
                    path.AddLine(this.Width, 0, this.Width, this.Height);
                    path.AddArc(new Rectangle(-1, this.Height - intPenWidth * 2, intPenWidth * 2, intPenWidth * 2), 90, 90);
                    path.AddLine(0, this.Height - intPenWidth, 0, intPenWidth);
                    path.AddArc(new Rectangle(-1, 0, intPenWidth * 2, intPenWidth * 2), 180, 90);
                    path.CloseAllFigures();
 
                    linePath.AddArc(new Rectangle(intPenWidth / 2, intPenWidth / 2 + 1, intPenWidth, intPenWidth), 271, -91);
                    linePath.AddArc(new Rectangle(intPenWidth / 2, this.Height - intPenWidth - intPenWidth / 2 - 1, intPenWidth, intPenWidth), 180, -91);
                    break;
            }
            //填充管道颜色
            g.FillPath(new SolidBrush(PipeColor), path);
            //渐变色
            int intCount = intPenWidth / 2 / 4;
            int intSplit = (255 - 100) / intCount;
            for (int i = 0; i < intCount; i++)
            {
                int _penWidth = intPenWidth / 2 - 4 * i;
                if (_penWidth <= 0)
                    _penWidth = 1;
                //画流动线外围的渐变色(浅白部分)
                g.DrawPath(new Pen(new SolidBrush(Color.FromArgb(40, Color.White.R, Color.White.G, Color.White.B)), _penWidth), linePath);
                if (_penWidth == 1)
                    break;
            }
            //液体的流动
            if (flowDirection != FlowDirection.None)
            {
                Pen p = new Pen(new SolidBrush(flowColor), flowWidth);
                //虚线的样式
                p.DashPattern = new float[] { flowLength, flowSpace };
                p.DashOffset = intLineLeft * (FlowDirection == FlowDirection.Forward ? -1 : 1);
                g.DrawPath(p, linePath);
            }
        }
    }
 
    /// <summary>
    /// 管道样式
    /// </summary>
    public enum PipeStyle
    {
        /// <summary>
        /// 直线 
        /// </summary>
        Horizontal_None_None,
        /// <summary>
        /// 左上
        /// </summary>
        Horizontal_Up_None,
        /// <summary>
        /// 左下
        /// </summary>
        Horizontal_Down_None,
        /// <summary>
        /// 右上
        /// </summary>
        Horizontal_None_Up,
        /// <summary>
        /// 右下
        /// </summary>
        Horizontal_None_Down,
        /// <summary>
        /// 左下右上
        /// </summary>
        Horizontal_Down_Up,
        /// <summary>
        /// 左上右下
        /// </summary>
        Horizontal_Up_Down,
        /// <summary>
        /// 左上,右上
        /// </summary>
        Horizontal_Up_Up,
        /// <summary>
        /// 左下右下
        /// </summary>
        Horizontal_Down_Down,
 
        /// <summary>
        /// 竖线
        /// </summary>
        Vertical_None_None,
        /// <summary>
        /// 上左
        /// </summary>
        Vertical_Left_None,
        /// <summary>
        /// 上右
        /// </summary>
        Vertical_Right_None,
        /// <summary>
        /// 下左
        /// </summary>
        Vertical_None_Left,
        /// <summary>
        /// 下右
        /// </summary>
        Vertical_None_Right,
        /// <summary>
        /// 上左下右
        /// </summary>
        Vertical_Left_Right,
        /// <summary>
        /// 上右下左
        /// </summary>
        Vertical_Right_Left,
        /// <summary>
        /// 上左下左
        /// </summary>
        Vertical_Left_Left,
        /// <summary>
        /// 上右下右
        /// </summary>
        Vertical_Right_Right,
    }
 
    /// <summary>
    /// 流动方向
    /// </summary>
    public enum FlowDirection
    {
        None,
        /// <summary>
        /// 向后
        /// </summary>
        Forward,
        /// <summary>
        /// 向前
        /// </summary>
        Backward
    }
}