Skip to content

Commit f15ecf9

Browse files
author
Gábor Zavarkó
committed
more cleanup
1 parent 26458ca commit f15ecf9

File tree

364 files changed

+9497
-9539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+9497
-9539
lines changed

.editorconfig

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ charset = utf-8-bom
1717
# Organize usings
1818
dotnet_sort_system_directives_first = true
1919
# this. preferences
20-
dotnet_style_qualification_for_field = false:silent
21-
dotnet_style_qualification_for_property = false:silent
22-
dotnet_style_qualification_for_method = false:silent
23-
dotnet_style_qualification_for_event = false:silent
20+
dotnet_style_qualification_for_field = false:suggestion
21+
dotnet_style_qualification_for_property = false:suggestion
22+
dotnet_style_qualification_for_method = false:suggestion
23+
dotnet_style_qualification_for_event = false:suggestion
2424
# Language keywords vs BCL types preferences
2525
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
2626
dotnet_style_predefined_type_for_member_access = true:silent

Demo/Demo.WindowsForms/BSE.Windows.Forms/ProgressBar/ProgressBar.cs

+70-75
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ public partial class ProgressBar : Control
6868
[Description("The color used for the background rectangle of this control.")]
6969
public Color BackgroundColor
7070
{
71-
get { return this._backgroundColor; }
71+
get { return _backgroundColor; }
7272
set
7373
{
74-
if (this._backgroundColor != value)
74+
if (_backgroundColor != value)
7575
{
76-
this._backgroundColor = value;
76+
_backgroundColor = value;
7777
OnBackgroundColorChanged(this, EventArgs.Empty);
7878
}
7979
}
@@ -90,12 +90,12 @@ public Color BackgroundColor
9090
[Description("The color used for the value rectangle of this control.")]
9191
public Color ValueColor
9292
{
93-
get { return this._valueColor; }
93+
get { return _valueColor; }
9494
set
9595
{
96-
if (this._valueColor != value)
96+
if (_valueColor != value)
9797
{
98-
this._valueColor = value;
98+
_valueColor = value;
9999
OnValueColorChanged(this, EventArgs.Empty);
100100
}
101101
}
@@ -110,12 +110,12 @@ public Color ValueColor
110110
/// </value>
111111
public Color BorderColor
112112
{
113-
get { return this._borderColor; }
113+
get { return _borderColor; }
114114
set
115115
{
116-
if (this._borderColor != value)
116+
if (_borderColor != value)
117117
{
118-
this._borderColor = value;
118+
_borderColor = value;
119119
OnBorderColorChanged(this, EventArgs.Empty);
120120
}
121121
}
@@ -143,10 +143,10 @@ public Color BorderColor
143143
[Description("The upper bound of range this ProgressBar is working with.")]
144144
public int Maximum
145145
{
146-
get { return this._iMaximum; }
146+
get { return _iMaximum; }
147147
set
148148
{
149-
if (this._iMaximum != value)
149+
if (_iMaximum != value)
150150
{
151151
if (value < 0)
152152
{
@@ -158,15 +158,15 @@ public int Maximum
158158
nameof(Maximum)));
159159
}
160160

161-
if (this._iMinimum > value)
161+
if (_iMinimum > value)
162162
{
163-
this._iMinimum = value;
163+
_iMinimum = value;
164164
}
165165

166-
this._iMaximum = value;
167-
if (this._iValue > this._iMaximum)
166+
_iMaximum = value;
167+
if (_iValue > _iMaximum)
168168
{
169-
this._iValue = this._iMaximum;
169+
_iValue = _iMaximum;
170170
}
171171

172172
UpdatePos();
@@ -185,10 +185,10 @@ public int Maximum
185185
[Description("The lower bound of range this ProgressBar is working with.")]
186186
public int Minimum
187187
{
188-
get { return this._iMinimum; }
188+
get { return _iMinimum; }
189189
set
190190
{
191-
if (this._iMinimum != value)
191+
if (_iMinimum != value)
192192
{
193193
if (value < 0)
194194
{
@@ -200,15 +200,15 @@ public int Minimum
200200
nameof(Minimum)));
201201
}
202202

203-
if (this._iMaximum < value)
203+
if (_iMaximum < value)
204204
{
205-
this._iMaximum = value;
205+
_iMaximum = value;
206206
}
207207

208-
this._iMinimum = value;
209-
if (this._iValue < this._iMinimum)
208+
_iMinimum = value;
209+
if (_iValue < _iMinimum)
210210
{
211-
this._iValue = this._iMinimum;
211+
_iValue = _iMinimum;
212212
}
213213

214214
UpdatePos();
@@ -228,23 +228,23 @@ public int Minimum
228228
"The current value for the ProgressBar, in the range specified by the minimum and maximum properties.")]
229229
public int Value
230230
{
231-
get { return this._iValue; }
231+
get { return _iValue; }
232232
set
233233
{
234-
if (this._iValue != value)
234+
if (_iValue != value)
235235
{
236-
if (value < this._iMinimum || value > this._iMaximum)
236+
if (value < _iMinimum || value > _iMaximum)
237237
{
238238
throw new ArgumentOutOfRangeException(nameof(Value),
239239
string.Format(CultureInfo.InvariantCulture,
240240
Resources.IDS_InvalidBoundArgument,
241-
new object[]
242-
{
243-
"Value", value.ToString(CultureInfo.CurrentCulture), "'minimum'", "'maximum'"
244-
}));
241+
nameof(Value),
242+
value.ToString(CultureInfo.CurrentCulture),
243+
"'minimum'",
244+
"'maximum'"));
245245
}
246246

247-
this._iValue = value;
247+
_iValue = value;
248248
UpdatePos();
249249
}
250250
}
@@ -259,18 +259,18 @@ public int Value
259259
/// </summary>
260260
public ProgressBar()
261261
{
262-
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
263-
this.SetStyle(ControlStyles.UserPaint, true);
264-
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
265-
this.SetStyle(ControlStyles.ResizeRedraw, true);
266-
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
262+
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
263+
SetStyle(ControlStyles.UserPaint, true);
264+
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
265+
SetStyle(ControlStyles.ResizeRedraw, true);
266+
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
267267
InitializeComponent();
268268

269-
this._iMaximum = 100;
270-
this._backgroundColor = Color.FromArgb(20, 20, 255);
271-
this._valueColor = Color.FromArgb(255, 0, 255);
272-
this._borderColor = SystemColors.ActiveBorder;
273-
this.BackColor = Color.Transparent;
269+
_iMaximum = 100;
270+
_backgroundColor = Color.FromArgb(20, 20, 255);
271+
_valueColor = Color.FromArgb(255, 0, 255);
272+
_borderColor = SystemColors.ActiveBorder;
273+
BackColor = Color.Transparent;
274274
}
275275

276276
#endregion
@@ -286,27 +286,26 @@ protected override void OnPaint(PaintEventArgs e)
286286
using (var antiAlias = new UseAntiAlias(e.Graphics))
287287
{
288288
var graphics = e.Graphics;
289-
DrawProgressBar(
290-
graphics,
291-
this.ClientRectangle,
292-
this._backgroundColor,
293-
this._valueColor,
294-
this._borderColor,
295-
this.RightToLeft,
296-
this.Minimum,
297-
this.Maximum,
298-
this.Value);
299-
300-
if (string.IsNullOrEmpty(this.Text) == false)
289+
DrawProgressBar(graphics,
290+
ClientRectangle,
291+
_backgroundColor,
292+
_valueColor,
293+
_borderColor,
294+
RightToLeft,
295+
Minimum,
296+
Maximum,
297+
Value);
298+
299+
if (string.IsNullOrEmpty(Text) == false)
301300
{
302301
using (var useClearTypeGridFit = new UseClearTypeGridFit(graphics))
303302
{
304-
using (SolidBrush textBrush = new SolidBrush(this.ForeColor))
303+
using (var textBrush = new SolidBrush(ForeColor))
305304
{
306-
using (StringFormat stringFormat = new StringFormat())
305+
using (var stringFormat = new StringFormat())
307306
{
308307
stringFormat.FormatFlags = StringFormatFlags.NoWrap;
309-
if (this.RightToLeft == RightToLeft.Yes)
308+
if (RightToLeft == RightToLeft.Yes)
310309
{
311310
stringFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
312311
}
@@ -315,8 +314,8 @@ protected override void OnPaint(PaintEventArgs e)
315314
stringFormat.LineAlignment = StringAlignment.Center;
316315
stringFormat.Alignment = StringAlignment.Center;
317316

318-
Rectangle stringRectangle = this.ClientRectangle;
319-
graphics.DrawString(this.Text, this.Font, textBrush, stringRectangle, stringFormat);
317+
var stringRectangle = ClientRectangle;
318+
graphics.DrawString(Text, Font, textBrush, stringRectangle, stringFormat);
320319
}
321320
}
322321
}
@@ -331,10 +330,10 @@ protected override void OnPaint(PaintEventArgs e)
331330
/// <param name="e">A EventArgs that contains the event data.</param>
332331
protected virtual void OnBorderColorChanged(object sender, EventArgs e)
333332
{
334-
this.Invalidate(true);
335-
if (this.BorderColorChanged != null)
333+
Invalidate(true);
334+
if (BorderColorChanged != null)
336335
{
337-
this.BorderColorChanged(sender, e);
336+
BorderColorChanged(sender, e);
338337
}
339338
}
340339

@@ -346,9 +345,9 @@ protected virtual void OnBorderColorChanged(object sender, EventArgs e)
346345
protected virtual void OnBackgroundColorChanged(object sender, EventArgs e)
347346
{
348347
Invalidate();
349-
if (this.BackgroundColorChanged != null)
348+
if (BackgroundColorChanged != null)
350349
{
351-
this.BackgroundColorChanged(sender, e);
350+
BackgroundColorChanged(sender, e);
352351
}
353352
}
354353

@@ -360,9 +359,9 @@ protected virtual void OnBackgroundColorChanged(object sender, EventArgs e)
360359
protected virtual void OnValueColorChanged(object sender, EventArgs e)
361360
{
362361
Invalidate(true);
363-
if (this.ValueColorChanged != null)
362+
if (ValueColorChanged != null)
364363
{
365-
this.ValueColorChanged(sender, e);
364+
ValueColorChanged(sender, e);
366365
}
367366
}
368367

@@ -372,7 +371,7 @@ protected virtual void OnValueColorChanged(object sender, EventArgs e)
372371

373372
private void UpdatePos()
374373
{
375-
this.Invalidate(true);
374+
Invalidate(true);
376375
}
377376

378377
private static void DrawProgressBar(
@@ -503,15 +502,11 @@ private static LinearGradientBrush GetGradientBackBrush(Rectangle bounds, Color
503502
return null;
504503
}
505504

506-
LinearGradientBrush linearGradientBrush = linearGradientBrush =
507-
new LinearGradientBrush(bounds, Color.White, backColor, LinearGradientMode.Vertical);
508-
if (linearGradientBrush != null)
509-
{
510-
Blend blend = new Blend();
511-
blend.Positions = new float[] {0.0F, 0.2F, 0.3F, 0.5F, 0.6F, 0.8F, 1.0F};
512-
blend.Factors = new float[] {0.3F, 0.4F, 0.5F, 0.8F, 1.0F, 1.0F, 0.9F};
513-
linearGradientBrush.Blend = blend;
514-
}
505+
var linearGradientBrush = new LinearGradientBrush(bounds, Color.White, backColor, LinearGradientMode.Vertical);
506+
var blend = new Blend();
507+
blend.Positions = new[] {0.0F, 0.2F, 0.3F, 0.5F, 0.6F, 0.8F, 1.0F};
508+
blend.Factors = new[] {0.3F, 0.4F, 0.5F, 0.8F, 1.0F, 1.0F, 0.9F};
509+
linearGradientBrush.Blend = blend;
515510

516511
return linearGradientBrush;
517512
}

0 commit comments

Comments
 (0)