PropertyGrid下拉列表的设置
public class FormulaClass : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new string[] { "0", "1" }); //编辑下拉框中的items
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
}
## 下拉列表
[Category("配置"), TypeConverter(typeof(FormulaClass))]