@@ -16,22 +16,16 @@ public class ColorProgressBar : System.Windows.Forms.Control
16
16
private int _Maximum = 100 ;
17
17
private int _Step = 10 ;
18
18
19
- private Color _BarColor = Color . FromArgb ( 255 , 128 , 128 ) ;
19
+ private Color _BarColor = Color . Green ;
20
20
private Color _BorderColor = Color . Black ;
21
21
22
- public enum FillStyles
23
- {
24
- Solid ,
25
- Dashed
26
- }
27
-
28
22
public ColorProgressBar ( )
29
23
{
30
- base . Size = new Size ( 150 , 15 ) ;
24
+ base . Size = new Size ( 200 , 20 ) ;
31
25
SetStyle ( ControlStyles . AllPaintingInWmPaint | ControlStyles . ResizeRedraw | ControlStyles . DoubleBuffer , true ) ;
32
26
}
33
27
34
- [ Description ( "ColorProgressBar color" ) ]
28
+ [ Description ( "Progress bar color" ) ]
35
29
[ Category ( "ColorProgressBar" ) ]
36
30
public Color BarColor
37
31
{
@@ -46,7 +40,7 @@ public Color BarColor
46
40
}
47
41
}
48
42
49
- [ Description ( "The current value for the ColorProgressBar, in the range specified by the Minimum and Maximum properties ." ) ]
43
+ [ Description ( "The current value for the progres bar. Must be between Minimum and Maximum." ) ]
50
44
[ Category ( "ColorProgressBar" ) ]
51
45
[ RefreshProperties ( RefreshProperties . All ) ]
52
46
public int Value
@@ -59,22 +53,20 @@ public int Value
59
53
{
60
54
if ( value < _Minimum )
61
55
{
62
- throw new ArgumentException ( "'" + value + "' is not a valid value for 'Value'.\n " +
63
- "'Value' must be between 'Minimum' and 'Maximum'." ) ;
56
+ throw new ArgumentException ( $ "'{ value } ' is not a valid 'Value'.\n 'Value' must be between 'Minimum' and 'Maximum'.") ;
64
57
}
65
58
66
59
if ( value > _Maximum )
67
60
{
68
- throw new ArgumentException ( "'" + value + "' is not a valid value for 'Value'.\n " +
69
- "'Value' must be between 'Minimum' and 'Maximum'." ) ;
61
+ throw new ArgumentException ( $ "'{ value } ' is not a valid 'Value'.\n 'Value' must be between 'Minimum' and 'Maximum'.") ;
70
62
}
71
63
72
64
_Value = value ;
73
65
this . Invalidate ( ) ;
74
66
}
75
67
}
76
68
77
- [ Description ( "The lower bound of the range this ColorProgressbar is working with ." ) ]
69
+ [ Description ( "The lower bound of the range." ) ]
78
70
[ Category ( "ColorProgressBar" ) ]
79
71
[ RefreshProperties ( RefreshProperties . All ) ]
80
72
public int Minimum
@@ -96,7 +88,7 @@ public int Minimum
96
88
}
97
89
}
98
90
99
- [ Description ( "The uppper bound of the range this ColorProgressbar is working with ." ) ]
91
+ [ Description ( "The uppper bound of the range." ) ]
100
92
[ Category ( "ColorProgressBar" ) ]
101
93
[ RefreshProperties ( RefreshProperties . All ) ]
102
94
public int Maximum
@@ -118,7 +110,7 @@ public int Maximum
118
110
}
119
111
}
120
112
121
- [ Description ( "The amount to jump the current value of the control by when the Step() method is called." ) ]
113
+ [ Description ( "The value to move the progess bar when the Step() method is called." ) ]
122
114
[ Category ( "ColorProgressBar" ) ]
123
115
public int Step
124
116
{
@@ -133,7 +125,7 @@ public int Step
133
125
}
134
126
}
135
127
136
- [ Description ( "The border color of ColorProgressBar " ) ]
128
+ [ Description ( "The border color" ) ]
137
129
[ Category ( "ColorProgressBar" ) ]
138
130
public Color BorderColor
139
131
{
@@ -149,7 +141,7 @@ public Color BorderColor
149
141
}
150
142
151
143
///
152
- /// <summary>Call the PerformStep() method to increase the value displayed by the amount set in the Step property</summary>
144
+ /// <summary>Call the PerformStep() method to increase the value displayed by the value set in the Step property</summary>
153
145
///
154
146
public void PerformStep ( )
155
147
{
@@ -162,7 +154,7 @@ public void PerformStep()
162
154
}
163
155
164
156
///
165
- /// <summary>Call the PerformStepBack() method to decrease the value displayed by the amount set in the Step property</summary>
157
+ /// <summary>Call the PerformStepBack() method to decrease the value displayed by the value set in the Step property</summary>
166
158
///
167
159
public void PerformStepBack ( )
168
160
{
@@ -175,7 +167,7 @@ public void PerformStepBack()
175
167
}
176
168
177
169
///
178
- /// <summary>Call the Increment() method to increase the value displayed by an integer you specify </summary>
170
+ /// <summary>Call the Increment() method to increase the value displayed by the passed value </summary>
179
171
///
180
172
public void Increment ( int value )
181
173
{
@@ -188,7 +180,7 @@ public void Increment(int value)
188
180
}
189
181
190
182
//
191
- // <summary>Call the Decrement() method to decrease the value displayed by an integer you specify </summary>
183
+ // <summary>Call the Decrement() method to decrease the value displayed by the passed value </summary>
192
184
//
193
185
public void Decrement ( int value )
194
186
{
@@ -236,8 +228,7 @@ protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
236
228
237
229
protected void DrawBorder ( Graphics g )
238
230
{
239
- Rectangle borderRect = new Rectangle ( 0 , 0 ,
240
- ClientRectangle . Width - 1 , ClientRectangle . Height - 1 ) ;
231
+ Rectangle borderRect = new Rectangle ( 0 , 0 , ClientRectangle . Width - 1 , ClientRectangle . Height - 1 ) ;
241
232
g . DrawRectangle ( new Pen ( _BorderColor , 1 ) , borderRect ) ;
242
233
}
243
234
}
0 commit comments