use*_*295 -2 c# openfiledialog
如何使用 OpenFileDialog 快速打开应用程序的文件夹?
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
...........
}
Run Code Online (Sandbox Code Playgroud)
猜测您的意思是“从我的应用程序文件夹中开始显示 OpenFileDialog”,只需OpenFileDialog.InitialDir在显示OpenFileDialog.
string AppPath = Path.GetDirectoryName(Application.ExecutablePath);;
openFileDialog1.InitialDir = AppPath;
Run Code Online (Sandbox Code Playgroud)
如果您需要帮助查找应用程序的目录,请参阅获取应用程序的根文件夹
| 归档时间: |
|
| 查看次数: |
3351 次 |
| 最近记录: |