| | |
loading multiple images for later use
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 47
Reputation:
Solved Threads: 0
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:
http://support.microsoft.com/kb/319292
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?)
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:
http://support.microsoft.com/kb/319292
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?)
•
•
Join Date: Jul 2008
Posts: 47
Reputation:
Solved Threads: 0
Thanks for the reply.
But how do I address them? (Name is es_red_orb.png in the resourceslist)
I've tried:
this.es_red_orb.png
this.es_red_orb
Mastermind.es_red_orb.png
Mastermind.es_red_orb
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!
But how do I address them? (Name is es_red_orb.png in the resourceslist)
I've tried:
this.es_red_orb.png
this.es_red_orb
Mastermind.es_red_orb.png
Mastermind.es_red_orb
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!
•
•
Join Date: Nov 2008
Posts: 44
Reputation:
Solved Threads: 4
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/0...lide-show.aspx
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/0...lide-show.aspx
.Net Developer - 3D Game Designer
My Portfolio/Blog: http://www.hieu.co.uk
My Portfolio/Blog: http://www.hieu.co.uk
![]() |
Similar Threads
- Random Images on Refresh (JavaScript / DHTML / AJAX)
- Images in signatures (Growing an Online Community)
- Multiple upload assigning specific names (PHP)
- thumbnail (VB.NET)
- Help With Delphi Petrol Pump Logic. (Pascal and Delphi)
- URGENT! Loading Roles From ticket.UserData (ASP.NET)
- Error loading "bridge.dll" (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Lock Folder in C#
- Next Thread: FileNet P8 4.0 .NET API
| Thread Tools | Search this Thread |
.net access algorithm angle array barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion convert csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum event excel file firefox form format forms function gdi+ httpwebrequest image index input install java label leak libraries list listbox mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






)