forked from daPhie79/ProgressODoom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlainProgressPainter.cs
66 lines (58 loc) · 1.75 KB
/
PlainProgressPainter.cs
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
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace ProgressODoom {
/// <summary></summary>
[ToolboxBitmapAttribute(typeof(ProgressODoom.PlainProgressPainter), "Icons.PlainProgressPainter.ico")]
public class PlainProgressPainter : AbstractProgressPainter, IProgressPainter, IDisposable {
private Color color;
private Brush brush;
private Color edge = Color.Transparent;
/// <summary></summary>
public PlainProgressPainter() {
this.Color = Color.FromArgb(151, 151, 234);
}
/// <summary></summary>
/// <param name="color"></param>
public PlainProgressPainter(Color color) {
this.Color = color;
}
/// <summary></summary>
[Category("Appearance"), Description("Gets or sets the color to draw the leading edge of the progress with"), Browsable(true)]
public Color LeadingEdge {
get { return this.edge; }
set { this.edge = value; FireChange(); }
}
/// <summary></summary>
[Category("Appearance"), Description("Gets or sets the base progress color"), Browsable(true)]
public Color Color {
get { return color; }
set {
color = value;
brush = new SolidBrush(color);
FireChange();
}
}
/// <summary></summary>
/// <param name="box"></param>
/// <param name="g"></param>
protected override void PaintThisProgress(Rectangle box, Graphics g) {
if (box.Width <= 1) {
return;
}
g.FillRectangle(brush, box);
if (gloss != null) {
gloss.PaintGloss(box, g);
}
if (!edge.Equals(Color.Transparent)) {
g.DrawLine(new Pen(new SolidBrush(edge), 1f), box.Right, box.Y, box.Right, box.Bottom - 1);
}
}
/// <summary></summary>
protected override void DisposeThis(bool disposing) {
brush.Dispose();
}
}
}