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
| #region Imports
|
| using System.Collections.Generic;
| using System.Drawing;
| using System.Drawing.Drawing2D;
| using System.Windows.Forms;
|
| #endregion
|
| namespace DPumpHydr.WinFrmUI.RLT.Controls
| {
| #region ParrotPieGraph
|
| public class ParrotPieGraph : Control
| {
| public ParrotPieGraph()
| {
| base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
| BackColor = Color.FromArgb(40, 40, 40);
| base.Size = new Size(100, 100);
| }
|
| private SmoothingMode _SmoothingType = SmoothingMode.AntiAlias;
| public SmoothingMode SmoothingType
| {
| get => _SmoothingType;
| set
| {
| _SmoothingType = value;
| Invalidate();
| }
| }
|
| private List<Color> _Colors = new()
| {
| Color.FromArgb(249, 55, 98),
| Color.FromArgb(219, 55, 128),
| Color.FromArgb(193, 58, 151),
| Color.FromArgb(166, 58, 182),
| Color.FromArgb(147, 61, 180),
| Color.FromArgb(126, 66, 186),
| Color.FromArgb(107, 70, 188),
| Color.FromArgb(77, 94, 210),
| Color.FromArgb(48, 119, 227),
| Color.FromArgb(23, 144, 249),
| Color.FromArgb(10, 148, 249),
| Color.FromArgb(0, 152, 250),
| Color.FromArgb(0, 162, 250),
| Color.FromArgb(0, 150, 212)
| };
| public List<Color> Colors
| {
| get => _Colors;
| set
| {
| _Colors = value;
| Invalidate();
| }
| }
|
| private List<int> _Numbers = new()
| {
| 5,
| 10,
| 6,
| 4,
| 9,
| 11,
| 3,
| 15,
| 12,
| 17,
| 3,
| 4,
| 6
| };
| public List<int> Numbers
| {
| get => _Numbers;
| set
| {
| int num = 0;
| foreach (int num2 in value)
| {
| num += num2;
| }
| if (num == 100)
| {
| _Numbers = value;
| }
| Invalidate();
| }
| }
|
| protected override void OnPaint(PaintEventArgs e)
| {
| e.Graphics.SmoothingMode = SmoothingType;
| int num = 0;
| int num2 = 0;
| int num3 = 0;
| foreach (int num4 in Numbers)
| {
| num3++;
| if (num3 == Numbers.Count)
| {
| e.Graphics.FillPie(new SolidBrush(Colors[num2]), 0, 0, base.Width, base.Height, num, 360 - num);
| }
| else
| {
| e.Graphics.FillPie(new SolidBrush(Colors[num2]), 0, 0, base.Width, base.Height, num, (int)(num4 * 3.6));
| }
| num2++;
| if (num2 == Numbers.Count + 1)
| {
| Colors.Reverse();
| num2 = 0;
| }
| num += (int)(num4 * 3.6);
| }
| base.OnPaint(e);
| }
| }
|
| #endregion
| }
|
|