Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Displaying Picture in both Forms

Displaying Picture in both Forms

Scheduled Pinned Locked Moved C#
help
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soulblazer
    wrote on last edited by
    #1

    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

    P D 2 Replies Last reply
    0
    • S Soulblazer

      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

      P Offline
      P Offline
      Pyro Joe
      wrote on last edited by
      #2

      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; }

      D 1 Reply Last reply
      0
      • S Soulblazer

        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

        D Offline
        D Offline
        DavidNohejl
        wrote on last edited by
        #3

        You can expose that picture (IIRC Image property of PictureBox) as public property of both forms. Than you can set image from one form to other. David

        1 Reply Last reply
        0
        • P Pyro Joe

          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; }

          D Offline
          D Offline
          DavidNohejl
          wrote on last edited by
          #4

          but his pictureBox1 and pictureBox2 are in two different forms... David

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups