-
Notifications
You must be signed in to change notification settings - Fork 1
/
CustomAlertControl.vb
95 lines (81 loc) · 3.25 KB
/
CustomAlertControl.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
84
85
86
87
88
89
90
91
92
93
94
95
Imports Microsoft.VisualBasic
Imports DevExpress.XtraBars.Alerter
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Drawing
Imports System.Windows.Forms
Namespace WindowsFormsApplication2
Public Class CustomAlertControl
Inherits AlertControl
Public Sub New()
End Sub
Public Sub New(ByVal container As System.ComponentModel.IContainer)
MyBase.New(container)
End Sub
Protected Overrides Function CreateAlertForm(ByVal location As System.Drawing.Point, ByVal control As AlertControl, ByVal info As AlertInfo) As AlertForm
Return New MyAlertForm(location, control, info)
End Function
Public Overloads Sub Show(ByVal owner As Form, ByVal caption As String, ByVal text As String, ByVal hotTrackedText As String, ByVal image As Image, ByVal tag As Object, ByVal color As Color)
MyBase.Show(owner, New MyAlertInfo(caption, text, hotTrackedText, image, tag, color))
End Sub
End Class
Public Class MyAlertForm
Inherits AlertForm
Public Sub New(ByVal location As System.Drawing.Point, ByVal control As IAlertControl, ByVal info As AlertInfo)
MyBase.New(location, control, info)
End Sub
Protected Overrides Function CreatePainter() As AlertPainter
Return New MyAlertPainter(Me)
End Function
End Class
Public Class MyAlertPainter
Inherits AlertPainter
Public Sub New(ByVal form As AlertFormCore)
MyBase.New(form)
End Sub
Protected Overrides Sub DrawContent(ByVal graphicsCache As DevExpress.Utils.Drawing.GraphicsCache, ByVal skin As DevExpress.Skins.Skin)
MyBase.DrawContent(graphicsCache, skin)
Dim alertInfo As MyAlertInfo = TryCast(Owner.Info, MyAlertInfo)
If alertInfo IsNot Nothing Then
Dim backColor As Color = alertInfo.BackColor
Dim rect As New Rectangle(Owner.ClientRectangle.Location, Owner.ClientRectangle.Size)
rect.Inflate(-2, -2)
Using brush As New SolidBrush(backColor)
graphicsCache.Graphics.FillRectangle(brush, rect)
End Using
End If
End Sub
End Class
Public Class MyAlertInfo
Inherits AlertInfo
Public Sub New(ByVal caption As String, ByVal text As String)
MyBase.New(caption, text)
End Sub
Public Sub New(ByVal caption As String, ByVal text As String, ByVal hotTrackedText As String)
MyBase.New(caption, text, hotTrackedText)
End Sub
Public Sub New(ByVal caption As String, ByVal text As String, ByVal image As Image)
MyBase.New(caption, text, image)
End Sub
Public Sub New(ByVal caption As String, ByVal text As String, ByVal hotTrackedText As String, ByVal image As Image)
MyBase.New(caption, text, hotTrackedText, image)
End Sub
Public Sub New(ByVal caption As String, ByVal text As String, ByVal hotTrackedText As String, ByVal image As Image, ByVal tag As Object)
MyBase.New(caption, text, hotTrackedText, image, tag)
End Sub
Public Sub New(ByVal caption As String, ByVal text As String, ByVal hotTrackedText As String, ByVal image As Image, ByVal tag As Object, ByVal color As Color)
MyBase.New(caption, text, hotTrackedText, image, tag)
BackColor = color
End Sub
Private privateBackColor As Color
Public Property BackColor() As Color
Get
Return privateBackColor
End Get
Set(ByVal value As Color)
privateBackColor = value
End Set
End Property
End Class
End Namespace