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. How create picture boxes runtime according to no. of pictures in a folder?

How create picture boxes runtime according to no. of pictures in a folder?

Scheduled Pinned Locked Moved C#
question
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.
  • A Offline
    A Offline
    abhishek29
    wrote on last edited by
    #1

    how i create no. of pictures boxes during runtime. The no. of picture boxes is equal to the no. of images in a folder. Thanks

    M M 2 Replies Last reply
    0
    • A abhishek29

      how i create no. of pictures boxes during runtime. The no. of picture boxes is equal to the no. of images in a folder. Thanks

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      use IO namespace to get the folder and file info loop through the files in the folder counting/creating a picturebox for each one

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • A abhishek29

        how i create no. of pictures boxes during runtime. The no. of picture boxes is equal to the no. of images in a folder. Thanks

        M Offline
        M Offline
        Mbah Dhaim
        wrote on last edited by
        #3

        do following steps : 1. list files in your selected directory using System.IO.Directory.GetFiles(PathToYourImageDirectory); 2. iterate along list of files in step no 1 3. Create a PictureBox ie : PictureBox pb = new PictureBox(); 4. Set your picture box property in step no 3, like Top, Left, Widht and Height. 5. Add your picture box to your form or other container control you use, with yourParentControl.Controls.Add(pb) 6. Load your image to picture box using pb.Image = Image.FromFile(TheFileFromList) 7. Repeat step no 3 until all files processed. hope this helps

        dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support

        A 1 Reply Last reply
        0
        • M Mbah Dhaim

          do following steps : 1. list files in your selected directory using System.IO.Directory.GetFiles(PathToYourImageDirectory); 2. iterate along list of files in step no 1 3. Create a PictureBox ie : PictureBox pb = new PictureBox(); 4. Set your picture box property in step no 3, like Top, Left, Widht and Height. 5. Add your picture box to your form or other container control you use, with yourParentControl.Controls.Add(pb) 6. Load your image to picture box using pb.Image = Image.FromFile(TheFileFromList) 7. Repeat step no 3 until all files processed. hope this helps

          dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support

          A Offline
          A Offline
          abhishek29
          wrote on last edited by
          #4

          Thanx A lot....... :)

          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