C# RestoreDirectory
2021-04-12 05:26
标签:sql dial filename pre dex file init rect pen OpenFileDialog与SaveFileDialog都有RestoreDirectory属性,这个属性默认是false,打开一 个文件后,那么系统默认目录就会指向刚才打开的文件。如果设为true就会使用系统默认目录 C# RestoreDirectory 标签:sql dial filename pre dex file init rect pen 原文地址:https://www.cnblogs.com/zhaogaojian/p/9013198.htmlstring fName;
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = Application.StartupPath ;
openFileDialog.Filter = "sql文件|*.sql|所有文件|*.*";
openFileDialog.RestoreDirectory = true;
openFileDialog.FilterIndex = 1;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fName = openFileDialog.FileName;
textBoxScript.Text = fName;
}
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
textBoxDir.Text = dialog.SelectedPath;
}
FolderBrowserDialog 没有该属性
下一篇:C# 开发网页的打印版
文章标题:C# RestoreDirectory
文章链接:http://soscw.com/index.php/essay/74575.html