1
在屬性包中,對於foo,我看到顯示了WindowsApplication1.foo,並且如何顯示有意義的文本?PropertyBag,類的類在編輯器中顯示,如何刪除它?
在屬性包中,我看到Foo | windowsApplication1.foo。我如何將windowsapplication1.foo更改爲一些有意義的文本? 感謝您的幫助。
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Form form = new Form();
PropertyGrid grid = new PropertyGrid();
grid.Dock = DockStyle.Fill;
form.Controls.Add(grid);
grid.SelectedObject = new MyType();
Application.Run(form);
}
}
class MyType
{
private Foo foo = new Foo();
[CategoryAttribute("ID"), DescriptionAttribute("Id")]
public Foo Foo
{
get { return foo; }
set { }
}
}
[Editor(typeof(FooEditor),typeof(UITypeEditor))]
[TypeConverter(typeof(ExpandableObjectConverter))]
class Foo
{
private string bar;
private string bar2;
public string Bar
{
get { return bar; }
set { bar = value; }
}
public string Bar2
{
get { return bar2; }
set { bar2 = value; }
}
}