2013-06-18 180 views
1

我有一个自定义窗体名称“Form1”,我想通过propertygrid控件打开。属性网格自定义编辑器

I want to make it like this enter image description here

这里

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

回答

0

您需要定义从UITypeEditor谁的工作将是显示Form1继承的类代码。这种类型是进入EditorAttribute(而不是Form1)。样本here或多或少是你需要实现的。基本上,您可以覆盖GetEditorStyle以返回UITypeEditorEditStyle.Modal并覆盖EditValue以在窗体的实例上调用IWindowsFormsEditorService.ShowDialog

+0

非常感谢您的回复。我给你投票了,但我会稍后尝试,如果它有效我会将你的答案标记为正确答案 再次感谢你 –

相关问题