C# WPF中调用打开文件对话框的代码
2021-02-07 23:15
标签:代码 cto redirect wpf filedia rect led == store C# WPF中调用打开文件对话框的代码 标签:代码 cto redirect wpf filedia rect led == store 原文地址:https://blog.51cto.com/14393435/2430351private string OpenDialog()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "选择文件";
openFileDialog.FileName = string.Empty;
openFileDialog.FilterIndex = 1;
openFileDialog.RestoreDirectory = true;
openFileDialog.DefaultExt = "txt";
if(openFileDialog.ShowDialog()==true)
{
return openFileDialog.FileName;
}else
{
return "";
}
}
文章标题:C# WPF中调用打开文件对话框的代码
文章链接:http://soscw.com/index.php/essay/52372.html