Everything that I have been able to find so far on creating buttons and the like all use a hard coded path for the associated image and largeImage properties of the button. Usually using something along the lines of:
button.Image = new BitmapImage(new Uri("C:\\MyTools\\Icons\\MyIcon.ico"))
I would like to embed my icons (as png probably) as resources within my dll. How do I reference the button image from that location and apply it to my button?
Thanks in advance for any assistance.
-G
Solved! Go to Solution.
Solved by Gary_J_Orr. Go to Solution.
Solved by Mustafa.Salaheldin. Go to Solution.
Solved by L.Maas. Go to Solution.
@Mustafa.Salaheldin Thanks for your great solution w/ clear instructions (message 3)! It's really helped me simplify my deployment.
There is something odd with Visual Studio, however. If you edit a .png, Visual Studio still builds the .dll with the OLD version of it. I've tried using "Clean Solution" and "Clean <namespace>" (and also re-launching VS after the cleans & before the build), but the only solution I've found is to manually remove the PNGs from the solution and then re-add them.
At least I've got all my icons in one folder, so I COULD just delete them all & re-add them anytime I need to refresh/be sure I have the latest (before a release, for example), but this seems odd to me - there's got to be a better way!
FYI, the only thing I changed was the dpi setting (there were a couple icons which I used some images from websites as starting points, so I didn't notice that the dpi wasn't set correctly to 96). I haven't tested to see if a change in the actual graphics triggers a refresh in VS, but I would think it would just go the simplest route and check the file stamp?
Can't find what you're looking for? Ask the community or share your knowledge.