像C#中Lable 控件的字体属性(就是属性前面带加号,可以展开有子项的那种)是如何实现的???最好有个简单的例子,谢谢了.

解决方案 »

  1.   

    你可以重写一个控件,继承于label控件
    需要重写组建了
      

  2.   


    public class myLable: System.Web.UI.WebControls.Lable
    {
     
    }
      

  3.   

    简单的方法就是用ExpandableObjectConverter:
        public class Example : Component
        {
            string name = "expandable";
            public string Name { get { return this.name; } set { this.name = value; } }        My my = new My();
            public My My { get { return this.my; } set { this.my = value; } }
        }    [TypeConverter(typeof(ExpandableObjectConverter))]   //<----
        public class My
        {
            int number, phone;        public int Number { get { return this.number; } set { this.number = value; } }
            public int Phone { get { return this.phone; } set { this.phone = value; } }
            public override string ToString() {return string.Format("{0}-{1}", this.number, this.phone);}
        }
      

  4.   

    可能我没说明白,我写了个UserControl  要实现一个类似字体那样的一个集合属性用户使用时,点+号展开,设置其子项属性。如何实现,是用Class 还是 struct????
      

  5.   

    谢谢 gomoku 了 。十分感谢.