kar*_*ins 9 .net c# propertygrid controls
我正在创建.net自定义控件,它应该能够加载多个文本文件.我有一个名为ListFiles的公共属性,其中包含以下属性:
[Browsable(true), Category("Configuration"), Description("List of Files to Load")]
public string ListFiles
{
get { return m_oList; }
set { m_oList = value; }
}
Run Code Online (Sandbox Code Playgroud)
根据对象的类型(string,string [],List,...),属性网格将允许用户输入一些数据.我的目标是在我的组件的属性网格中有一个过滤的openfiledialog这将使用户能够选择多个文件并将其作为数组或字符串(或其他东西......)返回.
Sooo ...这是我的问题:如何在自定义控件的属性网格中获得OpenFileDialog?
非常感谢!
小智 13
您可以使用内置的UITypeEditor.它被称为FileNameEditor
[EditorAttribute(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string SomeFilePath
{
get;
set;
}
Run Code Online (Sandbox Code Playgroud)