Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ribbon panel button image from embedded resource

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
Gary_J_Orr
15320 Views, 20 Replies

Ribbon panel button image from embedded resource

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

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
20 REPLIES 20
Message 21 of 21
lionel.kai
in reply to: Gary_J_Orr

@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?


Lionel J. Camara
BIM Manager at KAI Hawaii, Inc. - Structural and Forensic Engineers
Autodesk Certified Professional

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report