On the click event of the picturebox, I've tried the following:
picturebox1.image = imagelist1.index?????
I don't know the syntax, how do I choose a picture from an imagelist and place it into a picturebox. Thanks :)
On the click event of the picturebox, I've tried the following:
picturebox1.image = imagelist1.index?????
I don't know the syntax, how do I choose a picture from an imagelist and place it into a picturebox. Thanks :)
i guess the obvious imagelist1.images list escaped you?
Something like : picturebox1.image = imagelist1.Images[currentIndex]; might do the trick. imaglist must contain images of course.
Something like : picturebox1.image = imagelist1.Images[currentIndex]; might do the trick. imaglist must contain images of course.
Exactly what I was looking for. Thanks man. :D
Perhaps you could mark this thread as solved?
Another problem arises!
Here's what I want to program to do:
1. When the game starts the picturebox loads an image from the imagelist.
2. When the player clicks an image I want to the "if" statement to ask if the image in the picturebox is the imageindex "x".
How could I do this?
I think I'm asking the wrong question because this doesn't work:
private void pictureBox1_Click(object sender, EventArgs e)
{
if (pictureBox1.Image == imageList1.Images[0])
{
pictureBox1.Image = imageList1.Images[1];
}
}
You could always have a boolean flag which you use to show the different pictures ..
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.