获取新创建的文件夹下的图像路径

时间:2014-11-19 04:08:09

标签: c#

我在主项目下创建了一个文件夹(名称 - 图像),我想获取此Images文件夹下的图像路径,所以如何获取此路径.... 它是WinForm app

图像路径文件夹 - E:\ FileCopy \ FileCopy \ Images

2 个答案:

答案 0 :(得分:0)

如果您在Images文件夹中创建debug,则可以通过这种方式获取文件夹路径:

System.Windows.Forms.Application.StartupPath + "\Images\"

答案 1 :(得分:0)

System.AppDomain.CurrentDomain.BaseDirectory

使用bin \ Debug获取项目路径 和

var binIndex=projectPath.IndexOf(@"bin\Debug");

获取bin的索引。所以图片路径是

var path =string.Format("{0}Images",@projectPath.Substring(0, binIndex));
相关问题