日期:2008-05-31  浏览次数:20456 次

非要自己写。
算了。。大家自己看看吧。。不过我还是喜欢使用API。嘿嘿

目录选择对话框类
using System;

using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace Blood.Com.ClassLib
{
    /// <summary>
    /// 目录对话框控件
    /// </summary>
    public class DirectoryDialog
    {
        [ StructLayout( LayoutKind.Sequential, CharSet=CharSet.Ansi )]
        ///<summary>
        ///浏览信息
        ///</summary>
        public struct BROWSEINFO
        {
            public IntPtr hWndOwner;
            public int pIDLRoot;
            public string pszDisplayName;
            public string lpszTitle;
            public int ulFlags;
            public int lpfnCallback;
            public int lParam;
            public int iImage;
        }

        private const int MAX_PATH = 260;
        /// <summary>
        /// 指定浏览类型
        /// </summary>
        public enum BrowseForTypes
        {
            /// <summary>
            /// 浏览计算机
            /// </summary>
            Computers = 0x1000,
            /// <summary>
            /// 浏览目录
            /// </summary>
            Directories = 0x1,
            /// <summary>
            /// 浏览目录和文件
            /// </summary>
            /// <remarks>只能工作于4.71或更高的版本<remarks>
            FilesAndDirectories = 0x4000, // 4.71版
            /// <summary>
            /// 浏览系统根目录
            /// </summary>
            FileSy