标签:sql dial filename pre dex file init rect pen
OpenFileDialog与SaveFileDialog都有RestoreDirectory属性,这个属性默认是false,打开一
个文件后,那么系统默认目录就会指向刚才打开的文件。如果设为true就会使用系统默认目录
string 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 没有该属性
标签:sql dial filename pre dex file init rect pen
原文地址:https://www.cnblogs.com/zhaogaojian/p/9013198.html