I am trying to understand the use of resources when it comes to using a bitmap image in my program.
If I add an image to a background or a picture box, it somehow gets incorporated into my assembly, and all wired up and all I see is a resources.getObject being casted to a Bitmap call on a variable name and there is no where in my program anything about the actual file name of the image.
If I want to add an image to my assembly to use in a program, I understand about creating a bitmap from a file, but how can I incporporate the file in my program so I dont have to worry about distributing the file and instead it gets embedded in the assembly simliarly to how a picturebox gets its image. It seems like a great way to reference files that I want to keep hidden from the distribution, but I dont understand how to do it.
So for instance, if I set one background image in design view, it works without having a file reference in my code. What if I want to have a second, alternate background image that I can switch at runtime. How can I create this second image without having to reference the image file?
I see if I look at the resource file for the class, that the bitmap I set on the background seems to be embedded in the XML resource file. But how did this happen? Is this a good way to distribute an alternate background image, or is opening and loading a binary image file faster or better for other reasons?
thanks
Bryan
If I add an image to a background or a picture box, it somehow gets incorporated into my assembly, and all wired up and all I see is a resources.getObject being casted to a Bitmap call on a variable name and there is no where in my program anything about the actual file name of the image.
If I want to add an image to my assembly to use in a program, I understand about creating a bitmap from a file, but how can I incporporate the file in my program so I dont have to worry about distributing the file and instead it gets embedded in the assembly simliarly to how a picturebox gets its image. It seems like a great way to reference files that I want to keep hidden from the distribution, but I dont understand how to do it.
So for instance, if I set one background image in design view, it works without having a file reference in my code. What if I want to have a second, alternate background image that I can switch at runtime. How can I create this second image without having to reference the image file?
I see if I look at the resource file for the class, that the bitmap I set on the background seems to be embedded in the XML resource file. But how did this happen? Is this a good way to distribute an alternate background image, or is opening and loading a binary image file faster or better for other reasons?
thanks
Bryan
Last edited: