Including images in C# app (newbie)

  • Thread starter Thread starter Ranier Dunno
  • Start date Start date
R

Ranier Dunno

Hi,

I'd like to include some images in my Windows Forms app.
Currently I'm just reading a bunch of GIF files in a
folder, but I'd like to "hide" those images from the user
(to avoid deletion and manipulation). Basically, I'd like
the images to be "part" of the executable somehow. What do
I do?
 
-----Original Message-----
I think, use imagelist to import all image you want,

OK - do you (or someone) have a code snippet to show how
its done?

Thanks.
 
You can add the images to the application as resources.

Add them to the solution and set their Build Action in the properties window
to "Embedded resource" Then, to load them in your application you can use:

Bitmap
bm=Bitmap.FromStream(this.GetType().Assembly.GetManifestResourceStream("myAp
p.myResource.bmp"));

Note that you have to use a fully qualified name for the resource.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com
 
Back
Top