Hi all,

I've been working with C# for some time now, even created a Mastermind-game yesterday to learn some stuff (Mastermind is a very nice training project by the way, I really had fun coming up with solutions)

But while that I ran across a problem that I haven't been able to sort out. In my program I used 3 images to display in a picturebox, a red orb, an orange orb and a red orb. They were there to display wether the user was on the right track in the game.
But I couldn't for the life of me figure out how to get them compiled in the program without actually using them first!
I ended up creating 3 hidden pictureboxes with the images, this worked beautifully and nobody was the wiser, but I would still like to do this the right way (and learn by doing so)

Now I have found out about the resources thing (I'm using Visual Studio 2008 by the way) and this seemed like just what I needed.... But how the heck do I access those files after importing them?!

I've found this link from microsoft:
which seems to address my problem, but it seems incredibly more complicated then it should be in my eyes.

So my question is this:
I have multiple images I want to address but can't use them in an initial load, so how do I compile them in with the program, and how do I access them afterwards?

Thanks for reading and helping all!

(P.S. Am I just being blind or has the search-function vanished on the forum?)

Long as you add them as resources you can use them

Thanks for the reply.

But how do I address them? (Name is es_red_orb.png in the resourceslist)
I've tried:

and every other conceivable way!

Also, i've set the properties of the files I need to embedded resource (MS-site told me to)

Again, thanks for replying!

Hi, now there are 2 ways to do thing like that.
First do it like LizR said. So you could import it into resources. Then you could Access it by: Properties.Resources.ImageName

Second, you could load all the picture in the bitmap variables. By bitmap a = new bitmap(filepath); Then change the image picture point to this bitmap. You could check the code in one of my tutorial: http://www.hieu.co.uk/post/2008/12/04/Cnet-Basic-image-slide-show.aspx


The Properties.Resources.<imagename> worked splendid!

Thank you very much!

(Will be checking out some of those tuts as well I think ;) )

Both of you thanks for your time and answers!