//选择文件 OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowDialog(); MessageBox.Show(ofd.FileName); //选择文件夹 FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowDialog(); MessageBox.Show(fbd.SelectedPath);