-
Notifications
You must be signed in to change notification settings - Fork 0
/
XRProgressBar.cs
58 lines (52 loc) · 1.82 KB
/
XRProgressBar.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
using System.ComponentModel;
using System.Drawing;
using DevExpress.Utils.Serializing;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
namespace SmartTagCustomization {
[ToolboxItem(true)]
public class XRProgressBar : XRControl {
private float progress = 0;
private float maxVal = 100;
[DefaultValue(100), XtraSerializableProperty]
public float MaxValue {
get { return this.maxVal; }
set {
if (value <= 0)
return;
this.maxVal = value;
}
}
[DefaultValue(0), Bindable(true), XtraSerializableProperty]
public float Progress {
get { return this.progress; }
set {
if (value < 0 || value > maxVal)
return;
this.progress = value;
}
}
[Browsable(false)]
public override string Text {
get { return base.Text; }
set { base.Text = value; }
}
public XRProgressBar() {
this.ForeColor = SystemColors.Highlight;
this.Progress = 20.0f;
}
protected override VisualBrick CreateBrick(VisualBrick[] childrenBricks) {
return new PanelBrick(this);
}
protected override void PutStateToBrick(VisualBrick brick, PrintingSystemBase ps) {
base.PutStateToBrick(brick, ps);
PanelBrick panel = (PanelBrick)brick;
VisualBrick progressBar = new VisualBrick(this);
progressBar.Sides = BorderSide.None;
progressBar.BackColor = panel.Style.ForeColor;
progressBar.Rect = new RectangleF(0, 0, panel.Rect.Width * (Progress / MaxValue),
panel.Rect.Height);
panel.Bricks.Add(progressBar);
}
}
}