PropertyGrid.BrowsableAttributes是用来设置显示的属性
当不使用BrowsableAttribute标记属性,而是自定义标记属性时,需要实现自定义
public class Graphic2DEntityEditorBrowsableAttribute:Attribute
{
private bool _Browsable = true;
public bool Browsable
{
get
{
return _Browsable;
}
set
{
_Browsable=value;
}
}
public Graphic2DEntityEditorBrowsableAttribute()
{
}
public Graphic2DEntityEditorBrowsableAttribute(bool browsable)
{
_Browsable = browsable;
}
}
使用方式:
propertyGrid1.BrowsableAttributes = new AttributeCollection(new Attribute[] { new Graphic2DEntityEditorBrowsableAttribute() });
propertyGrid1.BrowsableAttributes = new AttributeCollection(new Attribute[] { new Graphic2DEntityEditorBrowsableAttribute() });