0

Hi!
Tried searching the forums but I came up short, sorry if I'm asking the same stupid question over and over.
I got a code snippet that looks like this

private void pictureBox1_Click(object sender, EventArgs e)
        {
            pictureBox1.Image = Image.FromFile(@"IMAGEPATH\test1.jpg");
        }

Since I'm a real newbie at programming I want to know how to code to make the other picture clickable aswell and when you click it it returns to the first image in the picturebox. Any help or links are appreciated (everything 'cept for rtfm-comments ;) )

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by jcao219
0

I guess I need to understand what you are looking for. Do you want multiple pictureboxes that are clickable? Or do you want to have multiple images cycle through a single picturebox when it's clicked?

0

Somethin like this?

private void pictureBox1_Click(object sender, EventArgs e)
        {
            if(pictureBox1.Image == Image.FromFile(@"IMAGEPATH\test1.jpg")){
                pictureBox1.Image = Image.FromFile(@"IMAGEPATH\test2.jpg");
            }else{
                pictureBox1.Image = Image.FromFile(@"IMAGEPATH\test1.jpg");
            }
        }

Edited by jcao219: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.