This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
AnotherColorPickEdit.cs
65 lines (58 loc) · 2.78 KB
/
AnotherColorPickEdit.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Drawing;
using DevExpress.XtraEditors.Registrator;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraEditors.ViewInfo;
using DevExpress.XtraTab;
namespace Q445945 {
[UserRepositoryItem("RegisterAnotherColorPickEdit")]
public class RepositoryItemAnotherColorPickEdit : RepositoryItemColorPickEdit {
static RepositoryItemAnotherColorPickEdit() {
RegisterAnotherColorPickEdit();
}
public const string CustomEditName = "AnotherColorPickEdit";
public RepositoryItemAnotherColorPickEdit() { }
public override string EditorTypeName { get { return CustomEditName; } }
public static void RegisterAnotherColorPickEdit() {
Image img = null;
EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomEditName, typeof(AnotherColorPickEdit), typeof(RepositoryItemAnotherColorPickEdit), typeof(ColorEditViewInfo), new ColorEditPainter(), true, img));
}
}
[ToolboxItem(true)]
public class AnotherColorPickEdit : ColorPickEdit {
static AnotherColorPickEdit() {
RepositoryItemAnotherColorPickEdit.RegisterAnotherColorPickEdit();
}
public AnotherColorPickEdit() { }
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public new RepositoryItemAnotherColorPickEdit Properties {
get { return base.Properties as RepositoryItemAnotherColorPickEdit; }
}
public override string EditorTypeName {
get { return RepositoryItemAnotherColorPickEdit.CustomEditName; }
}
public void RemoveColorsByNames(string pageName, List<string> colorNames) {
foreach (string name in colorNames)
RemoveColorByName(pageName, name);
}
public void RemoveColorByName(string pageName, string colorName) {
PopupColorPickEditForm frm = GetPopupForm() as PopupColorPickEditForm;
XtraTabControl tabs = frm.Controls.OfType<XtraTabControl>().FirstOrDefault();
if (tabs != null) {
XtraTabPage page = tabs.TabPages.Where(pg => pg.Text == pageName).FirstOrDefault() as XtraTabPage;
if (page != null) {
InnerColorListControl colorList = page.Controls.OfType<InnerColorListControl>().FirstOrDefault();
if (colorList != null) {
ColorItem item = colorList.Colors.OfType<ColorItem>().Where(c => c.Color == Color.FromName(colorName)).FirstOrDefault();
colorList.Colors.Remove(item);
}
}
}
}
}
}