/
MyBarButtonItem.vb
36 lines (27 loc) · 1.27 KB
/
MyBarButtonItem.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
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Styles
Namespace WindowsApplication1
Public Class MyBarButtonItem
Inherits BarButtonItem
Public Const BaseBarItemName As String = "BarButtonItem"
Public Const BarItemName As String = "MyBarButtonItem"
Public Const BarItemCaption As String = "My bar button"
Shared Sub New()
Call Register()
End Sub
Public Shared Sub Register()
Register(BarAndDockingController.Default)
End Sub
Public Shared Sub Register(ByVal controller As BarAndDockingController)
Register(controller.PaintStyles)
End Sub
Public Shared Sub Register(ByVal styles As BarManagerPaintStyleCollection)
For Each paintStyle As BarManagerPaintStyle In styles
Dim list As BarItemInfo = paintStyle.ItemInfoCollection(BaseBarItemName)
If list IsNot Nothing AndAlso paintStyle.ItemInfoCollection(BarItemName) Is Nothing Then
paintStyle.ItemInfoCollection.Add(New BarItemInfo(BarItemName, BarItemCaption, -1, GetType(MyBarButtonItem), list.LinkType, list.ViewInfoType, list.LinkPainter, True, False))
End If
Next
End Sub
End Class
End Namespace