public class People
{
List<Point> list; public List<Point> List
{
get { return list; }
set { list = value; }
}
} public Form1()
{
InitializeComponent();
People p1 = new People();
this.propertyGrid1.SelectedObject = p1;
}此时,属性框中的List属性,有省略号…样式的按键,点击后弹出 具体的属性设置对话框,请问如何操作这个对话框?
{
List<Point> list; public List<Point> List
{
get { return list; }
set { list = value; }
}
} public Form1()
{
InitializeComponent();
People p1 = new People();
this.propertyGrid1.SelectedObject = p1;
}此时,属性框中的List属性,有省略号…样式的按键,点击后弹出 具体的属性设置对话框,请问如何操作这个对话框?
public class People
{
List<Point> list = new List<Point>(); [Editor(typeof(MyListEditor), typeof(UITypeEditor))] //<--
public List<Point> List
{
get { return list; }
set { list = value; }
}
}class MyListEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
IWindowsFormsEditorService service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
Form editForm = new Form() { Text = "To be implemented" };
service.ShowDialog(editForm);
return value;
}
}