如何在自定义控件的属性网格中获取OpenFileDialog? [英] How can I get an OpenFileDialog in a custom control's property grid?

查看:70
本文介绍了如何在自定义控件的属性网格中获取OpenFileDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆