using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.Linq; using System.Text; using System.Windows.Forms.Design; namespace DPumpHydr.WinFrmUI.WenSkin.Design.Designer { public class TextDesigner : ControlDesigner { private DesignerActionListCollection actionLists; public override DesignerActionListCollection ActionLists { get { if (actionLists == null) { actionLists = new DesignerActionListCollection(); AddDesignerActionList(); } return actionLists; } } public virtual void AddDesignerActionList() { actionLists.Add(new TextBoxDesignerActionList(this.Component)); } public class TextBoxDesignerActionList : DesignerActionList { public TextBoxDesignerActionList(IComponent component) : base(component) { } public string Text { get => TypeDescriptor.GetProperties(this.Component)["Text"].GetValue(this.Component)?.ToString(); set => TypeDescriptor.GetProperties(this.Component)["Text"].SetValue(this.Component, value); } public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionPropertyItem text = new DesignerActionPropertyItem("Text", "文本"); return new DesignerActionItemCollection() { text }; } } } }