Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

From this thread:

Can you programmatically change the button image for a ESRI.ArcGIS.Desktop.AddIns.Button?

I've learned to change a command image programmatically, but... how can I programmatically get an image from the "Images" folder of the Addins, avoiding to write the physical file path?

Is there a way to quickly get access to the Addins resources?

share|improve this question
add comment

1 Answer

I guess it depends on what you mean by "quickly". The images are unpacked into the AssemblyCache under the user's profile.

Win7 example:
AppData\Local\ESRI\Desktop10.0\AssemblyCache\{3E0AB950-82E4-BF00-EA51-9FC591749394}\Images

I get the directory with something like this:

string dirpath =    Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"Images")

And then you can use normal .NET file IO to access the files. And these would be the files in visual studio that have a build action of AddInContent.

You can also add files with a build action as Embedded Resource and get it with GetManifestResourceStream:

http://stackoverflow.com/questions/278838/visual-studio-how-to-store-an-image-resource-as-an-embedded-resource/483891#483891

There might be other methods, but the two above are what I've used (I guess 3 of you count resources).

share|improve this answer
    
I'm sorry for my english: "quickly" it means for me a direct method from addins objects or something...but till now I have not found it. However, thank you for your suggestion, I tried it, but there is no Images folder in that path! I'm working on Windows Server 2003 and I get:C:\Documents and Settings\Administrator\Impostazioni locali\Dati applicazioni\ESRI\Desktop10.0\AssemblyCache\{26978580-636C-C40B-39CA-32C16B98529‌​C} I can see only the .dll files in this folder. Otherwise I don't like the Embedded Resource solution, I hope it's not the only way. –  user3835 Aug 3 '11 at 8:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.