如何在自定义控件的属性网格中获取OpenFileDialog? [英] How can I get an OpenFileDialog in a custom control's property grid?
问题描述
我正在创建.net自定义控件,它应该能够加载多个文本文件。我有一个名为ListFiles的公共属性,其中设置了以下属性:
I'm creating a .net custom control and it should be able to load multiple text files. I have a public property named ListFiles with those properties set :
[Browsable(true), Category("Configuration"), Description("List of Files to Load")]
public string ListFiles
{
get { return m_oList; }
set { m_oList = value; }
}
取决于对象的类型,(字符串,字符串[],列表,...),属性网格将允许用户输入一些数据。我的目标是在组件的属性网格中有一个经过过滤的openfile对话框,该对话框使用户可以选择多个文件并将其作为数组返回或字符串(或其他东西)。
Depending upon the type of object, (string, string[], List, ...), the property grid will allow the user to enter some data.. My goal would be to have a filtered openfiledialog in the Properties Grid of my component that would enable the user to choose multiple files and return it as an array or string (or something else...).
那么...这是我的问题:如何在自定义控件的属性网格中获取OpenFileDialog?
Sooo... Here's my question : How can I get an OpenFileDialog in a custom control's property grid?
非常感谢!
推荐答案
您可以通过添加 UITypeEditor 。
这是一个UITypeEditor的示例,它为您提供了用于选择文件名的OpenFileDialog
Here is an example of a UITypeEditor that gives you the OpenFileDialog for chossing a filename.
这篇关于如何在自定义控件的属性网格中获取OpenFileDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!