有没有一种方法可以使用对话框窗口获取没有名称文件的文件夹路径?

最佳答案

检查FolderBrowserDialog

// Bring up a dialog to chose a folder path in which to open or save a file.
private void folderMenuItem_Click(object sender, System.EventArgs e)
{
    var folderBrowserDialog1 = new FolderBrowserDialog();

    // Show the FolderBrowserDialog.
    DialogResult result = folderBrowserDialog1.ShowDialog();
    if( result == DialogResult.OK )
    {
        string folderName = folderBrowserDialog1.SelectedPath;
        ... //Do your work here!
    }
}

08-06 06:20