ASP.NET] 选择文件夹的对话框

using System.Windows.Forms.Design;
using System.Windows.Forms;

namespace TMS_WEB.Common
{
  public class FolderDialog : FolderNameEditor
    {
        FolderNameEditor.FolderBrowser fDialog = new System.Windows.Forms.Design.FolderNameEditor.FolderBrowser();
        public FolderDialog()
        {
        }
        public DialogResult DisplayDialog()
        {
            return DisplayDialog("请选择一个文件夹");
        }
       
        public DialogResult DisplayDialog(string description)
        {
            fDialog.Description = description;
            return fDialog.ShowDialog();
        }
        public string Path
        {
            get
            {
                return fDialog.DirectoryPath;
            }
        }

  ~FolderDialog()
        {
            fDialog.Dispose();
        }
    }
}

添加:System.Windows.Forms.Design;
System.Windows.Forms;

FolderDialog f = new FolderDialog();
   f.DisplayDialog();

posted on 2011-08-03 16:07  曾伟  阅读(1909)  评论(1编辑  收藏  举报

导航