C# 使用C语言列出文件夹表#
我想使用Visual C模拟下图的功能: 我知道这不是C# 使用C语言列出文件夹表#,c#,winforms,visual-studio-2010,listbox,directory,C#,Winforms,Visual Studio 2010,Listbox,Directory,我想使用Visual C模拟下图的功能: 我知道这不是textbox或combobox或richtext(可能)。 我设法获得了add函数,在这里我可以获得目录并选择它们: private void button8_Click(object sender, EventArgs e) { this.folderBrowserDialog1.ShowNewFolderButton = false; this.folderBrowserDialog1.RootFolder = Sys
textbox
或combobox
或richtext
(可能)。
我设法获得了add函数,在这里我可以获得目录并选择它们:
private void button8_Click(object sender, EventArgs e)
{
this.folderBrowserDialog1.ShowNewFolderButton = false;
this.folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.MyComputer;
DialogResult result = this.folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
// the code here will be executed if the user selects a folder
string path = this.folderBrowserDialog1.SelectedPath;
}
}
如何在图像中列出它们,是否应将其写入ini
文件或XML文件,如果是,如何在框中列出,如图所示
我还需要检测操作系统,并且列表中几乎没有默认文件夹。不太确定您想要什么,但图像显示了一个带有字符串和布尔值的列表。所以你可以用这样的方法:
public class DirOptions
{
string Path = string.Empty;
bool IncludeSubDirs = false;
}
然后,您可以将数据存储在列表中:
var list=newlist();
要检测操作系统,请执行以下操作:
请查看此问题谢谢@AlinaB我将使用此问题并返回。再次感谢你。
var list = new List<DirOptions>();