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

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

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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top