Deze post is geïmporteerd van de oude blog en is nog niet geconverteerd naar de nieuwe syntax.
As a I reply on my Non-Rectangular Form article, someone asked if you couldn't include the bitmap in the file.

Well, you can. And that is what this little article will talk about. This very little article.

When do you want to include things? If they are small and are vital for your app to run. This bitmap is vital! You could also include icons for example...

How do you do it?

Include your bitmap in your project. Go to it's properties and for 'Build Action' choose: Embedded Resource. This will compile your file into your .exe as a resource.

This was what we had to load our bitmap:

[csharp]
FileStream imageStream = File.OpenRead("Glass.bmp");
Bitmap imageBackground = (Bitmap)Bitmap.FromStream(imageStream);
[/csharp]

This is now:

[csharp]
Bitmap imageBackground = new Bitmap(this.GetType(), "Glass.bmp");
[/csharp]

That's it. Wasn't that simple? Your Bitmap is inside the .exe and it's loading fine.

I've uploaded this version as well.

Note: You can drag the .exe around and press 'q' to close it (for the people who haven't read the Non-Rectangular Form article ;) imagine having to kill it)
 
  • Reageer
    Items aangeduid met * zijn verplicht. (Naam, Email, Commentaar)
    Enkele items ontbreken of zijn fout ingevuld.
     
     
     
    Om zeker te zijn dat je geen computer bent, typ de onderstaande tekst over.