Dynamically Loading Images

Brian C

New member
Joined
Sep 4, 2009
Messages
1
Programming Experience
3-5
Hi All,

New to the forum so thought I would ask a hopefully easy question. I am trying to create a dire roller program and have it working. Its such that a user can select the number of 6 sided dice to roll and then see the number rolled on each die in a list.

What I would like to do is display images of dice in a list view. But I have not been able to do so as of yet. I have looked online for help on this but I can find nothing. It seems the only way I can do this is to manually place up to say 50 picture boxes on the form and only place images in the ones I need. For example the user rolls 19 dice, then I want to be able to display 19 die images. That sounds way too hard coded. Is there not a way that I can dynamically create objects and assign them to the correct image and then load them into a listview?

Any help would be appreciated. Whether code tips or web page tutorials.

Thanks

Brian
 
You do not have to use a PictureBox to display an image, you can draw directly onto the 'surface' of the Form/Panel/other Control.

All you have to do is keep track of the x and y coordinates to ensure them being drawn in the correct place.

Take a look at Calvin Hsia's WebLog : August 2006 - Posts, there are a series of blogs, starting 4 or 5 down entitled 'Various ways to draw multiple photographs....'.

That should get you started.

Hope this helps. :)
 
Back
Top