-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyProgressBarControl.vb
83 lines (69 loc) · 2.71 KB
/
MyProgressBarControl.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraPrinting
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Namespace WindowsApplication1
Public Class MyProgressBarControl
Inherits ProgressBarControl
Shared Sub New()
RepositoryItemMyProgressBarControl.RegisterMyProgressBarControl()
End Sub
Public Sub New()
MyBase.New()
End Sub
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return RepositoryItemMyProgressBarControl.MyProgressBarControlName
End Get
End Property
Public Shadows ReadOnly Property Properties() As RepositoryItemMyProgressBarControl
Get
Return CType(MyBase.Properties, RepositoryItemMyProgressBarControl)
End Get
End Property
<UserRepositoryItem("RegisterMyProgressBarControl")>
Public Class RepositoryItemMyProgressBarControl
Inherits RepositoryItemProgressBar
Public Const MyProgressBarControlName As String = "MyProgressBarControl"
Shared Sub New()
RegisterMyProgressBarControl()
End Sub
Public Sub New()
MyBase.New()
End Sub
Public Overrides Function GetBrick(ByVal info As PrintCellHelperInfo) As VisualBrick
Dim bmp As New Bitmap(info.Rectangle.Width, info.Rectangle.Height)
Dim gr As Graphics = Graphics.FromImage(bmp)
gr.FillRectangle(New SolidBrush(Color.White), info.Rectangle)
Dim brick As New ImageBrick(BorderSide.None, 0, Color.Transparent, Color.Transparent)
Dim width As Integer = Convert.ToInt32(info.Rectangle.Width * Convert.ToDouble(info.EditValue) / (CDbl(100)))
If width > 0 Then
gr.FillRectangle(New LinearGradientBrush(New Rectangle(0, 0, width, info.Rectangle.Height), Color.LightBlue, Color.White, 90, True), New Rectangle(0, 0, width, info.Rectangle.Height))
brick.Image = bmp
End If
gr.DrawString(info.DisplayText, info.Appearace.Font, New SolidBrush(Color.Black), New PointF(0, 0))
brick.Rect = info.Rectangle
Return brick
End Function
Public Shared Sub RegisterMyProgressBarControl()
EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(MyProgressBarControlName, GetType(MyProgressBarControl), GetType(RepositoryItemMyProgressBarControl), GetType(MyProgressBarViewInfo), New ProgressBarPainter(), True))
End Sub
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return MyProgressBarControlName
End Get
End Property
End Class
Public Class MyProgressBarViewInfo
Inherits ProgressBarViewInfo
Public Sub New(ByVal item As RepositoryItem)
MyBase.New(item)
End Sub
End Class
End Class
End Namespace