-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXRProgressBar.vb
68 lines (61 loc) · 2.24 KB
/
XRProgressBar.vb
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
Imports System.ComponentModel
Imports System.Drawing
Imports DevExpress.Utils.Serializing
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Namespace ReportDesigner_AddingCustomControl
<ToolboxItem(True)> _
Public Class XRProgressBar
Inherits XRControl
Private pos As Single = 0
Private maxVal As Single = 100
<DefaultValue(100), XtraSerializableProperty> _
Public Property MaxValue() As Single
Get
Return Me.maxVal
End Get
Set(ByVal value As Single)
If value <= 0 Then
Return
End If
Me.maxVal = value
End Set
End Property
<DefaultValue(0), Bindable(True), XtraSerializableProperty> _
Public Property Position() As Single
Get
Return Me.pos
End Get
Set(ByVal value As Single)
If value < 0 OrElse value > maxVal Then
Return
End If
Me.pos = value
End Set
End Property
<Browsable(False)> _
Public Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
End Set
End Property
Public Sub New()
Me.ForeColor = SystemColors.Highlight
End Sub
Protected Overrides Function CreateBrick(ByVal childrenBricks() As VisualBrick) As VisualBrick
Return New PanelBrick(Me)
End Function
Protected Overrides Sub PutStateToBrick(ByVal brick As VisualBrick, ByVal ps As PrintingSystemBase)
MyBase.PutStateToBrick(brick, ps)
Dim panel As PanelBrick = CType(brick, PanelBrick)
Dim progressBar As New VisualBrick(Me)
progressBar.Sides = BorderSide.None
progressBar.BackColor = panel.Style.ForeColor
progressBar.Rect = New RectangleF(0, 0, panel.Rect.Width * (Position / MaxValue), panel.Rect.Height)
panel.Bricks.Add(progressBar)
End Sub
End Class
End Namespace