I'm using VS2005 ... when you set a button image, is that image stored in the app's resources like the icon is, or do I have to do that manually.

Now, don't think I'm crazy for asking this... :P

I was a long time Delphi user, and in Delphi when you set a button's image at design-time, it auto-magically loaded that image into the app's resources for you so the image didn't have to follow the app around. Of course, you always had the option to load it dynamically at run-time and just distribute the image with your app.

And yes, I know I could test this myself ... but that is "conditional behavior" information by a noob [me].

I would like to know for sure.

Recommended Answers

All 2 Replies

Yes, this image is held in a resource file.

When you set a button's image you have the choice of Local resource or Project resource.
For a Project resource you choose an image from one already loaded in to (or add one to) the application wide resource file.
For a Local resource you select a file using a file open dialog; in this case the image is stored in the form's own resource file (e.g. form1.resx).

So in both cases the image is held in a resource file.

The Local resource has the advantage that the image is copied with the form if you later import the form in to another project/solution.
The Project resource reduces code size if you use the image in serval buttons on different forms.
Use common sense to get the balance you need when choosing which route to use.

commented: An excellent and complete response!!!! +1

Yes, this image is held in a resource file.

When you set a button's image you have the choice of Local resource or Project resource.
For a Project resource you choose an image from one already loaded in to (or add one to) the application wide resource file.
For a Local resource you select a file using a file open dialog; in this case the image is stored in the form's own resource file (e.g. form1.resx).

So in both cases the image is held in a resource file.

The Local resource has the advantage that the image is copied with the form if you later import the form in to another project/solution.
The Project resource reduces code size if you use the image in serval buttons on different forms.
Use common sense to get the balance you need when choosing which route to use.

I couldn't ask for a more informative and complete response Nick! Rep++ ... thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.