This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RepositoryItemMyButtonEdit.vb
74 lines (59 loc) · 2.44 KB
/
RepositoryItemMyButtonEdit.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
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.Registrator
Imports System.ComponentModel
Imports DevExpress.XtraEditors.ViewInfo
Namespace CustomDrawButtonEvent
Public Class RepositoryItemMyButtonEdit
Inherits RepositoryItemButtonEdit
Shared Sub New()
Register()
End Sub
Public Sub New()
End Sub
Friend Const EditorName As String = "MyButtonEdit"
Public Shared Sub Register()
EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(EditorName, GetType(MyButtonEdit), GetType(RepositoryItemMyButtonEdit), GetType(ButtonEditViewInfo), New CustomButtonEditPainter(), True, 0, GetType(DevExpress.Accessibility.ButtonEditAccessible)))
End Sub
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return EditorName
End Get
End Property
Private Shared ReadOnly drawButtonField As Object = New Object()
<Description("Occurs when custom editor buttons are being drawn."), Category(CategoryName.Events)> _
Public Custom Event DrawButton As DrawButtonEventHandler
AddHandler(ByVal value As DrawButtonEventHandler)
Me.Events.AddHandler(drawButtonField, value)
End AddHandler
RemoveHandler(ByVal value As DrawButtonEventHandler)
Me.Events.RemoveHandler(drawButtonField, value)
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As DrawButtonEventArgs)
End RaiseEvent
End Event
Protected Friend Overridable Sub RaiseDrawButtonEvent(ByVal e As DrawButtonEventArgs)
Dim handler As DrawButtonEventHandler = CType(Me.Events(drawButtonField), DrawButtonEventHandler)
If handler IsNot Nothing Then
handler(GetEventSender(), e)
End If
End Sub
Public Overrides Sub Assign(ByVal item As RepositoryItem)
Dim source As RepositoryItemMyButtonEdit = TryCast(item, RepositoryItemMyButtonEdit)
BeginUpdate()
Try
MyBase.Assign(item)
If source Is Nothing Then
Return
End If
Finally
EndUpdate()
End Try
Events.AddHandler(drawButtonField, source.Events(drawButtonField))
End Sub
End Class
End Namespace