This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RepositoryItemCustomEdit.vb
84 lines (73 loc) · 2.33 KB
/
RepositoryItemCustomEdit.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
Imports Microsoft.VisualBasic
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.ViewInfo
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Linq
Imports System.Reflection
Imports System.Text
Namespace WindowsFormsApplication475
<UserRepositoryItem("RegisterCustomEdit")> _
Public Class RepositoryItemCustomEdit
Inherits RepositoryItemColorPickEdit
'The static constructor that calls the registration method
Shared Sub New()
RegisterCustomEdit()
End Sub
'Initialize new properties
Public Sub New()
useDefaultMode_Renamed = True
End Sub
'The unique name for the custom editor
Public Const CustomEditName As String = "CustomEdit"
'Return the unique name
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return CustomEditName
End Get
End Property
'Register the editor
Public Shared Sub RegisterCustomEdit()
'Icon representing the editor within a container editor's Designer
Dim img As Image = Nothing
Try
img = CType(Bitmap.FromStream(System.Reflection.Assembly.GetExecutingAssembly(). GetManifestResourceStream("DevExpress.CustomEditors.CustomEdit.bmp")), Bitmap)
Catch
End Try
EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(CustomEditName, GetType(CustomEdit), GetType(RepositoryItemCustomEdit), GetType(ColorEditViewInfo), New ColorEditPainter(), True, img))
End Sub
'A custom property
Private useDefaultMode_Renamed As Boolean
Public Property UseDefaultMode() As Boolean
Get
Return useDefaultMode_Renamed
End Get
Set(ByVal value As Boolean)
If useDefaultMode_Renamed <> value Then
useDefaultMode_Renamed = value
OnPropertiesChanged()
End If
End Set
End Property
'Override the Assign method
Public Overrides Sub Assign(ByVal item As RepositoryItem)
BeginUpdate()
Try
MyBase.Assign(item)
Dim source As RepositoryItemCustomEdit = TryCast(item, RepositoryItemCustomEdit)
If source Is Nothing Then
Return
End If
useDefaultMode_Renamed = source.UseDefaultMode
Finally
EndUpdate()
End Try
End Sub
Public Overrides Function CreateViewInfo() As BaseEditViewInfo
Return New MyColorEditViewInfo(Me)
End Function
End Class
End Namespace