yangyin
2024-10-25 1e65c49ba929103e79d87322ca1a3573c2b532e2
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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Controls
{
    [Serializable]
    public class WenListViewItem : ListViewItem
    {
        public WenListView WenListView = null;
        public WenListViewItem() : base()
        {
        }
        public WenListViewItem(WenListView owner) : base()
        {
            this.WenListView = owner;
        }
 
        protected WenListViewItem(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) : base(serializationInfo, streamingContext)
        {
        }
 
        private WenListViewItemCellCollection cells;
 
        public WenListViewItemCellCollection Cells => cells ??= new WenListViewItemCellCollection(this);
 
        public class WenListViewItemCell
        {
            public WenListViewItemCell()
            {
            }
 
            public WenListViewItemCell(string name, object value)
            {
                Name = name;
                Value = value;
            }
 
            public string Name { get; set; }
            public object Value { get; set; }
            public override string ToString() => Value?.ToString();
        }
        public class WenListViewItemCellCollection : List<WenListViewItemCell>
        {
            private readonly WenListViewItem owner;
            public WenListViewItemCellCollection(WenListViewItem owner)
            {
                this.owner = owner;
            }
 
            public void Add(string name, object value)
            {
                base.Add(new WenListViewItemCell(name, value));
            }
 
            public WenListViewItemCell this[string key]
            {
                get => base.Find(q => q.Name.ToUpper() == key.ToUpper());
                set => base.Find(q => q.Name.ToUpper() == key.ToUpper()).Value = value.Value;
            }
        }
    }
}