在列表框中显示文件夹,在另一个列表框中显示子文件夹

问题描述:

大家好



我正在尝试创建一个Autocad插件来预览datagridview中的缩略图



我有两个列表框我想将它们绑定在一起并在datagridview中显示.bmp



1-listbox1 show Directory

2-listbox2从所选文件夹中显示子文件夹(listbox1)

3 - 然后在.gmp视图中显示.bmp文件



我成功了第一个问题



我尝试过的事情:



hi all

I'm trying to create an Autocad plugin to preview thumbnails in datagridview

I have two listboxes I want to binding them together and show the .bmp in datagridview

1-listbox1 show Directory
2-listbox2 show subfolder from the selected folder (listbox1)
3-and then the .bmp files show in datagridview

I succeed to figure the first question

What I have tried:

String[] dirs = System.IO.Directory.GetDirectories(@"D:\test\Blocks");
            int i;
            for (i = 0; i < dirs.Length; i++)
            {
                listBox1.Items.Add(Path.GetFileName(dirs[i]));
            }

            String[] files = System.IO.Directory.GetFiles(@"D:\test\Blocks");
            for (i = 0; i < files.Length; i++)
            {
                listBox1.Items.Add(Path.GetFileName(files[i]));
            }

看看详细的数据绑定教程 [ ^ ],有一些明确的说明和例子。
Take a look at A Detailed Data Binding Tutorial[^], which has some clear expalnations and examples.