C# WinForm 选择目录路径和文件路径

private string SelectPath() //弹出一个选择目录的对话框
{
     FolderBrowserDialog path = new FolderBrowserDialog();
     path.ShowDialog();
     return path.SelectedPath;
}
private string SelectFile() //弹出一个选择文件的对话框
{
     OpenFileDialog file = new OpenFileDialog();
     file.ShowDialog();
     return file.SafeFileName;
}

 

posted @ 2014-06-12 16:42  仆人  阅读(11239)  评论(0编辑  收藏  举报