public class myLable: System.Web.UI.WebControls.Lable {
}
简单的方法就是用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);} }
需要重写组建了
public class myLable: System.Web.UI.WebControls.Lable
{
}
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);}
}