Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
which collections to use to to link images to a value then be able to display that image with that value, when select that image in a random sequence
Posted
Comments
JakirBB 25-Jul-12 7:21am    
Dictionary< image, value>

Try this
C#
Bitmap image = new Bitmap(filename);
Dictionary<bitmap,> ImageInfo = new Dictionary<bitmap,>();
ImageInfo[image] = 1;


Now you can use the value by ImageInfo[image].

Cheers... :)
 
Share this answer
 
i do not understand your question. A Dictionary<value,system.drawing.image> is probably the answer you are looking for, where value is an Integer or whatever, but it would help if you would tell us which Graphic-Framework you use, how the Click-Event is designed and how the Images are referred.
 
Share this answer
 
Comments
Stsheda 25-Jul-12 10:57am    
i wanted to create a appication on framework 3.5 where i can have like 40 pics and with values using collections so when someone clicks a button it selects random images in my resource folder and displays it in a picbox with the value on my label i.e image 1-40, values 1-9, label1 and picbox1, my email is matjhesti33@yahoo.com
efkah 27-Jul-12 7:28am    
1.) u want to read a List of Images from a Folder? -> Google for "Read Files from Folder c#".
2.) u want to randomly select 1 Image -> Load the Links into a List<string> myPics, google for "c# random", and select myPics[randomNumber]
3.) u want to show a Image in a Windows.Forms.PictureBox -> google for "picturebox load from file c#"
4.) u want to write a Text into an Image -> google for "picturebox draw text"
5.) maybe u want to save the Image afterwards? -> google for "picturebox save to file in c#"

cant help you anymore since i dont know the picturebox class quite well...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900