Вопрос немного неясен, но у меня складывается впечатление, что вы идете по пути, по которому был установлен exe-файл?
class Program
{
static Dictionary<string, string> typeImages = null;
static string GetImagePath(string type)
{
if (typeImages == null)
{
typeImages = new Dictionary<string, string>();
string appPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string path = Path.Combine(appPath, @"image/");
foreach (string file in Directory.GetFiles(path))
{
typeImages.Add(Path.GetFileNameWithoutExtension(file).ToUpper(), Path.GetFullPath(file));
}
}
if (typeImages.ContainsKey(type))
return typeImages[type];
else
return typeImages["OTHER"];
}
static void Main(string[] args)
{
Console.WriteLine("File for XLS="+GetImagePath("XLS"));
Console.WriteLine("File for ZZZ=" + GetImagePath("ZZZ"));
Console.ReadKey();
}
}
Это даст вам папку с изображениями, которая будет находиться везде, где находитсяустановлено.В среде разработчиков вам нужно будет создать каталог с изображениями при отладке и выпуске в пути приложения, потому что именно там VS помещает исполняемый файл.