在属性包中,对于 foo,我看到显示了 WindowsApplication1.foo,我如何显示一些有意义的文本?
在属性包中,我看到了 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; }
}
}