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
/
AnotherColorPickEdit.vb
80 lines (71 loc) · 3.19 KB
/
AnotherColorPickEdit.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
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Linq
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraTab
Namespace Q445945
<UserRepositoryItem("RegisterAnotherColorPickEdit")> _
Public Class RepositoryItemAnotherColorPickEdit
Inherits RepositoryItemColorPickEdit
Shared Sub New()
RegisterAnotherColorPickEdit()
End Sub
Public Const CustomEditName As String = "AnotherColorPickEdit"
Public Sub New()
End Sub
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return CustomEditName
End Get
End Property
Public Shared Sub RegisterAnotherColorPickEdit()
Dim img As Image = Nothing
EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(CustomEditName, GetType(AnotherColorPickEdit), GetType(RepositoryItemAnotherColorPickEdit), GetType(ColorEditViewInfo), New ColorEditPainter(), True, img))
End Sub
End Class
<ToolboxItem(True)> _
Public Class AnotherColorPickEdit
Inherits ColorPickEdit
Shared Sub New()
RepositoryItemAnotherColorPickEdit.RegisterAnotherColorPickEdit()
End Sub
Public Sub New()
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Shadows ReadOnly Property Properties() As RepositoryItemAnotherColorPickEdit
Get
Return TryCast(MyBase.Properties, RepositoryItemAnotherColorPickEdit)
End Get
End Property
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return RepositoryItemAnotherColorPickEdit.CustomEditName
End Get
End Property
Public Sub RemoveColorsByNames(ByVal pageName As String, ByVal colorNames As List(Of String))
For Each name As String In colorNames
RemoveColorByName(pageName, name)
Next name
End Sub
Public Sub RemoveColorByName(ByVal pageName As String, ByVal colorName As String)
Dim frm As PopupColorPickEditForm = TryCast(GetPopupForm(), PopupColorPickEditForm)
Dim tabs As XtraTabControl = frm.Controls.OfType(Of XtraTabControl)().FirstOrDefault()
If tabs IsNot Nothing Then
Dim page As XtraTabPage = TryCast(tabs.TabPages.Where(Function(pg) pg.Text = pageName).FirstOrDefault(), XtraTabPage)
If page IsNot Nothing Then
Dim colorList As InnerColorListControl = page.Controls.OfType(Of InnerColorListControl)().FirstOrDefault()
If colorList IsNot Nothing Then
Dim item As ColorItem = colorList.Colors.OfType(Of ColorItem)().Where(Function(c) c.Color = Color.FromName(colorName)).FirstOrDefault()
colorList.Colors.Remove(item)
End If
End If
End If
End Sub
End Class
End Namespace