资源简介

使用Winform控件从头编写的文件选择对话框,所有样式均可以自行定制。 可自行扩展各种自定义功能,无阻碍。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

namespace FilePickDialog
{
    public partial class FilePickDialog : Form
    {
        /// 
        /// 最终所选文件夹路径
        /// 

        string str = null;
        /// 
        /// 选中文件夹列表
        /// 

        TreeNode checkedNodes=new TreeNode();
        /// 
        /// 文件夹内文件过滤字符串
        /// 

        string fileType = null;
        /// 
        /// 标题名
        /// 

        string titlename;
        /// 
        /// 上一个路径
        /// 

        List lastFilePath = new List();
        /// 
        /// 文件路径列表
        /// 

        List filePathList = new List();
        /// 
        /// 文件路径列表
        /// 

        public List FilePathList
        {
            get
            {
                if (filePathList.Count != 0)
                {
                    return filePathList;
                }
                else {
                    return null;
                }
            }
        }
        /// 
        /// 构造函数
        /// 

        /// 
        /// 
        public FilePickDialog(string name string Filter)
        {
            this.titlename = name;
            fileType = Filter;
            InitializeComponent();
        }
        public string getValue {
            get {
                return str;
            }
        }
        /// 
        /// 窗口加载时动作
        /// 

        /// 
        /// 
        private void 文件选择窗口_Load(object sender EventArgs e)
        {
            this.Text = titlename+“文件选择“; //+ “数据文件夹选择“ + “(可用Ctrl或Shift进行多选)“;
            TreeViewLoad(sendere);
            ListViewSysImages(this.listView1);
            UpdateListView(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
            //UpdateListView(@“d:\“);
        }
        #region 左侧文件夹树操作
        /// 
        /// 加载文件夹树
        /// 

        /// 
        /// 
        private void TreeViewLoad(object sender EventArgs e)
        {
            this.treeView1.StateImageList = imageList1;
            treeView1.ImageIndex = 2;
            treeView1.ShowLines = false;
            TreeNode tRoot = new TreeNode(“桌面“ 0 0);
            this.treeView1.Nodes.Add(tRoot);
            tRoot.ImageIndex = 0;
            tRoot.SelectedImageIndex = tRoot.ImageIndex;
            string[] drivers = null;
            //增加磁盘根目录节点
            TreeNode tRo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-08-13 16:25  FilePickDialog\
     目录           0  2013-08-13 16:23  FilePickDialog\FilePickDialog\
     文件        2554  2013-08-13 16:27  FilePickDialog\FilePickDialog.sln
     文件       24576  2013-08-14 21:21  FilePickDialog\FilePickDialog.suo
     目录           0  2013-08-13 16:23  FilePickDialog\FilePickDialog\bin\
     目录           0  2013-08-13 16:30  FilePickDialog\FilePickDialog\bin\Debug\
     文件       30208  2013-08-15 09:43  FilePickDialog\FilePickDialog\bin\Debug\FilePickDialog.dll
     文件       36352  2013-08-15 09:43  FilePickDialog\FilePickDialog\bin\Debug\FilePickDialog.pdb
     目录           0  2013-08-13 16:23  FilePickDialog\FilePickDialog\bin\Release\
     文件       20940  2013-08-15 09:43  FilePickDialog\FilePickDialog\FilePickDialog.cs
     文件        3021  2013-08-13 17:38  FilePickDialog\FilePickDialog\FilePickDialog.csproj
     文件       21350  2013-08-15 09:40  FilePickDialog\FilePickDialog\FilePickDialog.Designer.cs
     文件       16951  2013-08-15 09:40  FilePickDialog\FilePickDialog\FilePickDialog.resx
     目录           0  2013-08-13 16:23  FilePickDialog\FilePickDialog\obj\
     目录           0  2013-08-15 09:43  FilePickDialog\FilePickDialog\obj\Debug\
     文件        5174  2013-08-15 09:43  FilePickDialog\FilePickDialog\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1458  2013-08-15 08:53  FilePickDialog\FilePickDialog\obj\Debug\FilePickDialog.csproj.FileListAbsolute.txt
     文件       30208  2013-08-15 09:43  FilePickDialog\FilePickDialog\obj\Debug\FilePickDialog.dll
     文件        7826  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\FilePickDialog.FilePickDialog.resources
     文件       36352  2013-08-15 09:43  FilePickDialog\FilePickDialog\obj\Debug\FilePickDialog.pdb
     文件         180  2013-08-13 17:38  FilePickDialog\FilePickDialog\obj\Debug\FilePickDialog.Properties.Resources.resources
     文件         686  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.read.1.tlog
     文件           2  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.read.4.tlog
     文件           2  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.read.5.tlog
     文件           2  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.read.6.tlog
     文件         658  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.write.1.tlog
     文件           2  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.write.4.tlog
     文件           2  2013-08-15 09:40  FilePickDialog\FilePickDialog\obj\Debug\GenerateResource-ResGen.write.5.tlog
     目录           0  2013-08-13 17:35  FilePickDialog\FilePickDialog\obj\Debug\TempPE\
     文件        4096  2013-08-13 17:35  FilePickDialog\FilePickDialog\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
     目录           0  2013-08-13 17:35  FilePickDialog\FilePickDialog\Properties\
............此处省略36个文件信息

评论

共有 条评论