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 }; } } } }