在列表框中显示文件夹,在另一个列表框中显示子文件夹 [英] Show folders in listbox and subfolders in another listbox

查看:87
本文介绍了在列表框中显示文件夹,在另一个列表框中显示子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在尝试创建一个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.


这篇关于在列表框中显示文件夹,在另一个列表框中显示子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆