C# 属性网格自定义编辑器

C# 属性网格自定义编辑器,c#,.net,propertygrid,C#,.net,Propertygrid,我有一个自定义表单名“Form1”,我想通过propertygrid控件打开它 代码在这里 [CategoryAttribute("Extended Properties"), EditorAttribute(typeof(System.Windows.Forms.Form1), typeof(System.Drawing.Design.UITypeEditor))] [TypeConverter(typeof(ExpandableObjectConverte

我有一个自定义表单名“Form1”,我想通过propertygrid控件打开它

代码在这里

[CategoryAttribute("Extended Properties"),
        EditorAttribute(typeof(System.Windows.Forms.Form1), typeof(System.Drawing.Design.UITypeEditor))]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public string Path { get; set; }

您需要定义一个继承自
UITypeEditor
的类,该类的任务是显示
Form1
。此类型是进入
编辑属性
(而不是
表单1
)的类型。这个示例或多或少是您需要实现的。基本上,您可以覆盖
GetEditorStyle
以返回
UITypeEditorEditStyle.Modal
并覆盖
EditValue
以调用表单实例上的
IwinowsFormsEditorService.ShowDialog

非常感谢您的回复。我将放弃你们的投票权,但我会稍后再试,如果成功的话,我会把你们的答案标记为正确答案,再次感谢你们