yangyin
2025-02-28 baa80d650adebcce70f1113cc1020c6039c159a0
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using static DPumpHydr.WinFrmUI.WenSkin.Controls.WenTreeViewColumn;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Design.Designer
{
    public class WenTreeViewColumnDesigner : TextDesigner
    {
        public override void AddDesignerActionList()
        {
            this.ActionLists.Add(new WenDesignerActionList(this.Component));
        }
 
        public class WenDesignerActionList : TextBoxDesignerActionList
        {
            public WenDesignerActionList(IComponent component) : base(component)
            {
            }
 
            public int ItemHeight
            {
                get => (int)TypeDescriptor.GetProperties(this.Component)["ItemHeight"].GetValue(this.Component);
                set => TypeDescriptor.GetProperties(this.Component)["ItemHeight"].SetValue(this.Component, value);
            }
            public bool LabelEdit
            {
                get => (bool)TypeDescriptor.GetProperties(this.Component)["LabelEdit"].GetValue(this.Component);
                set => TypeDescriptor.GetProperties(this.Component)["LabelEdit"].SetValue(this.Component, value);
            }
 
            public string DefaultTextColumn
            {
                get => TypeDescriptor.GetProperties(this.Component)["DefaultTextColumn"].GetValue(this.Component)?.ToString();
                set => TypeDescriptor.GetProperties(this.Component)["DefaultTextColumn"].SetValue(this.Component, value);
            }
            public TreeNodeCollection Nodes
            {
                get => TypeDescriptor.GetProperties(this.Component)["Nodes"].GetValue(this.Component) as TreeNodeCollection;
                set => TypeDescriptor.GetProperties(this.Component)["Nodes"].SetValue(this.Component, value);
            }
            [Editor(typeof(Design.Editor.WenCollectionEditor), typeof(UITypeEditor))]
            public ColumnHeaderCollection Columns
            {
                get => TypeDescriptor.GetProperties(this.Component)["Columns"].GetValue(this.Component) as ColumnHeaderCollection;
                set => TypeDescriptor.GetProperties(this.Component)["Columns"].SetValue(this.Component, value);
            }
 
            public override DesignerActionItemCollection GetSortedActionItems()
            {
                DesignerActionPropertyItem text = new DesignerActionPropertyItem("Text", "文本");
                DesignerActionPropertyItem defaultTextColumn = new DesignerActionPropertyItem("DefaultTextColumn", "默认值");
 
                DesignerActionPropertyItem labelEdit = new DesignerActionPropertyItem("LabelEdit", "是否编辑");
                DesignerActionPropertyItem itemHeight = new DesignerActionPropertyItem("ItemHeight", "项高度");
 
                DesignerActionPropertyItem nodes = new DesignerActionPropertyItem("Nodes", "节点集合");
                DesignerActionPropertyItem columns = new DesignerActionPropertyItem("Columns", "列集合");
 
 
                return new DesignerActionItemCollection() { text, defaultTextColumn, labelEdit, itemHeight, nodes,columns };
            }
        }
    }
}