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. .NET (Core and Framework)
  4. How to new a PictureBox...??

How to new a PictureBox...??

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdesigndata-structurestutorialquestion
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    My C# project Form is splitted into two parts, the left side is a tree view, the right side is a PictureBox. I want to design a function, When I click the menu button , A new PictureBox will appear, like the MDI Form does. How to new a PictureBox like that...?? or there are other better solutions...?? My original PictureBox's image must be saved, so I can't just change it's image, But if I want to new many pages, New many PictureBoxes doesn't seem to a good way...?? Please give me a hand,thanks a lot!!

    P 1 Reply Last reply
    0
    • L Lost User

      My C# project Form is splitted into two parts, the left side is a tree view, the right side is a PictureBox. I want to design a function, When I click the menu button , A new PictureBox will appear, like the MDI Form does. How to new a PictureBox like that...?? or there are other better solutions...?? My original PictureBox's image must be saved, so I can't just change it's image, But if I want to new many pages, New many PictureBoxes doesn't seem to a good way...?? Please give me a hand,thanks a lot!!

      P Offline
      P Offline
      Peter Reiter
      wrote on last edited by
      #2

      you can save the picture and then load the new one to save: System.Drawing.Image img = pictureBox1.Image; img.Save(path, ImageFormat); to load a new one: System.Drawing.Image img2 = System.Drawing.Image.FromFile(path); pictureBox1.Image = img2;

      F 1 Reply Last reply
      0
      • P Peter Reiter

        you can save the picture and then load the new one to save: System.Drawing.Image img = pictureBox1.Image; img.Save(path, ImageFormat); to load a new one: System.Drawing.Image img2 = System.Drawing.Image.FromFile(path); pictureBox1.Image = img2;

        F Offline
        F Offline
        Fade Amit BS
        wrote on last edited by
        #3

        A quick side note: if you only need the images to be saved during run-time (i.e. for GUI purposes) you can also crate a list or array of System.Drawing.Image just to keep them in memory, this could save you the usage of files, which you should afterwards clean up, might be easier. Fade (Amit BS)

        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