如何设置打开文件对话框出现的初始目录?我想将其更改为位于我的 /bin/Debug 文件夹中的图像文件夹。我只是无法让它工作。
opdPicture.Title = "Choose a Picture";
opdPicture.InitialDirectory = ""; //Don't know what to set this to.
Application.StartupPath将为您提供 exe 所在的目录,所以我想您想使用Path.Combine来获取相对于启动路径的图像目录。
var imagePath = System.IO.Path.Combine( Application.StartupPath, "images" )
opdPicture.Title = "Choose a Picture";
opdPicture.InitialDirectory = imagePath ;