考虑一个带有一些 customUserControl和Button.
在 Visual Studio 设计器中,您可以单击属性右侧的按钮(就像您更改控件上的其他常用属性时一样,例如Font或Image)并为此属性使用编辑器。
在运行时,如果您已将 a 添加PropertyGrid到表单并将其指向 this UserControl,您还可以在运行时单击该复杂属性右侧的按钮并获得相同的UITypeEditor对话框。
我怎样才能让这个编辑器窗口在运行时通过说,一个按钮点击而不PropertyGrid在表单上出现?
虽然我已经从这个描述符中得到了 thePropertyDescriptor和 the UITypeEditor,但我不知道调用什么来获取实例ITypeDescriptorContext以及IServiceProvider调用什么时候UITypeEditor.EditValue让编辑器显示。
这与为属性构建自定义 UITypeEditor 相关:Building Windows Forms Controls and Components with Rich Design-Time Features。在这种情况下,我已经配置了所有这些并且一切都运行良好,所以我只想在运行时调用编辑器窗口。