Displaying Picture in both Forms
-
can some one help me out i am trying to display a picture in form1 picturebox into form2 picturebox(the same picture) i thought of using the parent and child thingie but i could not acheive what i want. thankz in advance
-
can some one help me out i am trying to display a picture in form1 picturebox into form2 picturebox(the same picture) i thought of using the parent and child thingie but i could not acheive what i want. thankz in advance
couldn't you just do this: pictureBox1.Image = Image.FromFile(@"c:\image.jpg"); pictureBox2.Image = pictureBox1.Image; yep, I just tried it and had success. (I used this code on the click of a button with two picture boxes set to default value names) if (openFileDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.Image = Image.FromFile(openFileDialog1.FileName); pictureBox2.Image = pictureBox1.Image; }
-
can some one help me out i am trying to display a picture in form1 picturebox into form2 picturebox(the same picture) i thought of using the parent and child thingie but i could not acheive what i want. thankz in advance
You can expose that picture (IIRC
Image
property ofPictureBox
) as public property of both forms. Than you can set image from one form to other. David -
couldn't you just do this: pictureBox1.Image = Image.FromFile(@"c:\image.jpg"); pictureBox2.Image = pictureBox1.Image; yep, I just tried it and had success. (I used this code on the click of a button with two picture boxes set to default value names) if (openFileDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.Image = Image.FromFile(openFileDialog1.FileName); pictureBox2.Image = pictureBox1.Image; }
but his pictureBox1 and pictureBox2 are in two different forms... David