Image Resources - What is difference between Local Resource and Project Resource File
-
Hello Everyone- I'm learning C#. I am working with adding some images into an application now, for example, on a button. When I select Image, I am presented with a couple of options. I can import an image under "Local Resource" or I can import the image under "Project Resource File". I am wondering what the difference is between the two, and which one I should be using? It appears that when I select an image to be imported into the project resource file, the next time I compile it, the executable is bigger, so I'm assuming that the images are compiled into the exe? (Ie, so I do not have to distribute individual image files with my application??) Thank you!
-
Hello Everyone- I'm learning C#. I am working with adding some images into an application now, for example, on a button. When I select Image, I am presented with a couple of options. I can import an image under "Local Resource" or I can import the image under "Project Resource File". I am wondering what the difference is between the two, and which one I should be using? It appears that when I select an image to be imported into the project resource file, the next time I compile it, the executable is bigger, so I'm assuming that the images are compiled into the exe? (Ie, so I do not have to distribute individual image files with my application??) Thank you!
Yes, the image is compiled into the .exe (in both cases). A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms. A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
-
Yes, the image is compiled into the .exe (in both cases). A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms. A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
-
Yes, the image is compiled into the .exe (in both cases). A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms. A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
Daniel Grunwald wrote:
A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms. A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
Thanks! Neat, I never knew that. I always just picked "Project resource". That worked, so that was good enough for me. :)
-
Yes, the image is compiled into the .exe (in both cases). A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms. A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.