Reloading Image File at Compile

  • Thread starter Thread starter Matthew Wieder
  • Start date Start date
M

Matthew Wieder

I have a form which contains a picturebox control which displays a gif
image. By default, the image that was selected when I designed the
dialog gets stored in the resx file and gets compiled and displayed.
How can I force the compiler to re-link to that gif file on the file
system at compile time so that I don't need to re-assign the gif file
every time a change is made to it?
thanks!
 
You can make a tiny C# app that will modify your resx file and make it run
during Pre-build step.

-vJ
 
Is there a way to have this functionality occur generically, or must I
wrote ode for every image in every dialog of every application? It
would seem to be useful functionality.
thanks!
 
Another way to do this would be add your GIF image as an "Embedded resource"
and have the file added as a "link" to the original file, in your project.

This way, whenever the file changes, your compiler should pick up the latest
one available.

But if you have it as an embedded resource, you would have to retrieve the
image at run-time and use it appropriately. The designer can only pick
resources using the Resource Manager.

-vJ
 
Check out
Image myPicture = System.Drawing.Image.FromFile(@"picturename.gif");
Almost any graphic display method is overloaded to take an Image as a
picture parameter. I used it to load an ImageList directly from the
application directory. Works great.

Chuck
 
Back
Top