//選擇文件 OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowDialog(); MessageBox.Show(ofd.FileName); //選擇文件夾 FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowDialog(); MessageBox.Show(fbd.SelectedPath);