Compile image with EXE?

mjb3030

Well-known member
Joined
Aug 14, 2003
Messages
76
Is there some way to include an image with a compiled EXE? If not, is there any other way to create a form with a background image that can be distributed as exe only?
 
If you set the Forms background image property it will embed the image for you in the EXE. Otherwise, you can include a binary file in your project (a BMP for instance), change its property to embedded resource, and "load" it at runtime to set as the Forms background.

-Nerseus
 
Originally posted by Nerseus
... and "load" it at runtime to set as the Forms background.

Accomplished via:

Code:
Me.BackGroundImage = Image.FromStream([Assembly].GetExecutingAssembly().GetManifestResourceStream("image filename goes here"))
 
Thank you both. I am now moving in the right direction. Im still not quite getting it, but I think that is because I still need to gain a better understanding of assemblies and embedded resources. I have no trouble doing this in Visual Studio, but I am trying to also learn to do everything in straight code in Notepad because I want to be able to fully grasp what is going on behind the scenes.
 
The easiest way to understand how the .NET framework is put together is to browse through the Object Browser. Visual Studio doesnt hide any of the source code from you, it just adds a little to save you the typing. It has to many advantages to ignore (intellisense and debugger just to name a couple).
 
I know, but I feel that I have been learning faster since I began using this "basic" approach because it is forcing me to write all the form code myself rather than relying on the IDE. Eventually, I am going to switch back to using VS after I feel very comfortable with the code.

However, I also want to learn all about compiling and packaging inside and out without having to rely completely on VS or MSI. I am a rather competent VB6 programmer, but I never learned enough about deployment to be able to fix anything more serious than a basic "missing dll" kind of installation error. I want to avoid making that mistake with .NET. I guess Ill be checking out the Deployment Forum before this thread gets moved because Ive strayed too far off topic! Thanks again.
 
Back
Top