I am using Visual Studio 2010 and C#. to build an Add-Im. I am trying to utilize/call images in my code that reside in my Images folder. So, in the solution explorer, I have added some images to my 'Images' folder. I also have a multi item list that generates multiple items in a menu (depending on a loop counter). Code below
Item item = new Item(); item.Caption = Convert.ToString(_propertySet.GetProperty(ELEMENT_NAME)); item.Message = Convert.ToString(_propertySet.GetProperty(ELEMENT_NAME)); item.Enabled = true; item.Image = Image.FromFile(@"C:\Users\MyId\Desktop\Project\Stuff\Images\cmdContextMenu.png"); item.Tag = _propertySet.GetProperty(ELEMENT_NAME);
I use the entire path on MY machine to get to the image and reference it from the 'Images' folder. Now, if I were to finish this up, package it up, and move it other peoples machines, i'm thinking there would be problems with trying to find this image. Is there some kind of solution to this issue or a way of not having to reference the entire path?? Its kind of a vague question/scenario but any help on this would be greatly appreciated. Thanks in advance.