FolderBrowserDialog open = new FolderBrowserDialog();            if (open.ShowDialog() == DialogResult.OK)
            {
                this.textBox_path.Text = open.SelectedPath.ToString();
            } 这个是浏览文件夹对话框
如何做一个类试功能但不是对话框而是窗体左边的一个功能
如图
http://61.153.32.58:8011/123.jpg

解决方案 »

  1.   

    //下来看看,一个开源的
    //我测试了效果很成http://www.elavefenix.net/ficheros/My_Explorer_src.zip
      

  2.   

    //......
                       protected void PopulateDirectory(TreeNode nodeCurrent, TreeNodeCollection nodeCurrentCollection)
    {
    TreeNode nodeDir;
    int imageIndex = 2; //unselected image index
    int selectIndex = 3; //selected image index            if (nodeCurrent.SelectedImageIndex != 0) 
    {
    //populate treeview with folders
    try
    {
    //check path
    if(Directory.Exists(getFullPath(nodeCurrent.FullPath)) == false)
    {
    MessageBox.Show("Directory or path " + nodeCurrent.ToString() + " does not exist.");
    }
    else
    {
    //populate files
    PopulateFiles(nodeCurrent); string[] stringDirectories = Directory.GetDirectories(getFullPath(nodeCurrent.FullPath));
    string stringFullPath = "";
    string stringPathName = ""; //loop throught all directories
    foreach (string stringDir in stringDirectories)
    {
    stringFullPath = stringDir;
    stringPathName = GetPathName(stringFullPath);

    //create node for directories
    nodeDir = new TreeNode(stringPathName.ToString(),imageIndex,selectIndex);
    nodeCurrentCollection.Add(nodeDir);
    }
    }
    }
    catch (IOException e)
    {
    MessageBox.Show("Error: Drive not ready or directory does not exist.");
    }
    catch (UnauthorizedAccessException e)
    {
    MessageBox.Show("Error: Drive or directory access denided.");
    }
    catch (Exception e)
    {
    MessageBox.Show("Error: " + e);
    }
    }
    }