yangyin
2025-03-27 b0de14c2670b9ff0079dacfb4b7457b438368f11
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#region Imports
 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing.Design;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Child.Material
{
    #region MaterialItemCollectionChild
 
    [Editor(typeof(MaterialItemCollectionEditor), typeof(UITypeEditor))]
    public class MaterialItemCollection : Collection<object>
    {
        public event EventHandler ItemUpdated;
 
        public delegate void EventHandler(object sender, EventArgs e);
 
        public void AddRange(IEnumerable<object> items)
        {
            foreach (object item in items)
            {
                Add(item);
            }
        }
 
        public void AddRange(string[] items)
        {
            foreach (object item in items)
            {
                Add(item);
            }
        }
 
        protected new void Add(object item)
        {
            base.Add(item);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void InsertItem(int index, object item)
        {
            base.InsertItem(index, item);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void RemoveItem(int value)
        {
            base.RemoveItem(value);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected new void Clear()
        {
            base.Clear();
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void ClearItems()
        {
            base.ClearItems();
            ItemUpdated?.Invoke(this, null);
        }
    }
 
    #endregion
 
    #region MaterialListBoxItemChild
 
    public class MaterialListBoxItem
    {
        #region Property Region
 
        public string Text { get; set; }
        public string SecondaryText { get; set; }
        public object Tag { get; set; }
 
        //public Bitmap Icon { get; set; }
 
        #endregion
 
        #region Constructor Region
 
        public MaterialListBoxItem()
        {
            Text = "ListBoxItem";
            SecondaryText = "";
        }
 
        public MaterialListBoxItem(string text)
        {
            Text = text;
        }
 
        public MaterialListBoxItem(string text, string secondarytext)
        {
            Text = text;
            SecondaryText = secondarytext;
        }
 
        public MaterialListBoxItem(string text, string secondarytext, object tag)
        {
            Text = text;
            SecondaryText = secondarytext;
            Tag = tag;
        }
 
        //public MaterialListBoxItem(string text, Bitmap icon) : this(text)
        //{
        //    Icon = icon;
        //}
 
        #endregion
    }
 
    #endregion
}