Visual Studio: Differences between image paths set from the project window and programmatically set image paths

StackOverflow https://stackoverflow.com/questions/17678870

Question

I'm programming in C# and noticed that in Visual Studio if I set the path for an image from within the project window (click on the image -> Source in the poperty window), the compiled program can always find it. If I set the image path programmatically instead, the image has always to be in the right directory. Now, the question is: where are the images stored in the first method? Is it possible to do that also programmatically? Thank you very much.

Regards, Marco.

Was it helpful?

Solution

In first instance images are stored as a resouce file and are saved in the resources. Whereas in the second instance you specify the path where the image resides.

Yes you can add image in resources progamatically if you are working in .net 4 or above. See this for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top