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. Multiple Picture Boxes

Multiple Picture Boxes

Scheduled Pinned Locked Moved C#
questionhelptutorial
4 Posts 4 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.
  • J Offline
    J Offline
    JMOdom
    wrote on last edited by
    #1

    I have a question(s) that I hope someone can answer. I know how to make a picture box either visible or invisible and also how to load one image into it. :confused: The questions are: Can more than one image be loaded into a picture box at one time? If so how is it done and how do you show each picture when needed? If it can't be done, what are my alternatives? I'm trying to get three pictures into the same picture box area, and show each in turn as a specific button is clicked. Thank you for any help or suggestions that are forth coming. :-D

    B A 2 Replies Last reply
    0
    • J JMOdom

      I have a question(s) that I hope someone can answer. I know how to make a picture box either visible or invisible and also how to load one image into it. :confused: The questions are: Can more than one image be loaded into a picture box at one time? If so how is it done and how do you show each picture when needed? If it can't be done, what are my alternatives? I'm trying to get three pictures into the same picture box area, and show each in turn as a specific button is clicked. Thank you for any help or suggestions that are forth coming. :-D

      B Offline
      B Offline
      BoneSoft
      wrote on last edited by
      #2

      Nope, you can't. Luckily, you have the ability to define variables ;P Declare and initialize three Images and set the PictureBox's Image property to the appropriate one when you need to.


      Try code model generation tools at BoneSoft.com.

      1 Reply Last reply
      0
      • J JMOdom

        I have a question(s) that I hope someone can answer. I know how to make a picture box either visible or invisible and also how to load one image into it. :confused: The questions are: Can more than one image be loaded into a picture box at one time? If so how is it done and how do you show each picture when needed? If it can't be done, what are my alternatives? I'm trying to get three pictures into the same picture box area, and show each in turn as a specific button is clicked. Thank you for any help or suggestions that are forth coming. :-D

        A Offline
        A Offline
        Arun Immanuel
        wrote on last edited by
        #3

        Use Imagelist control.

        Regards, Arun Kumar.A

        A 1 Reply Last reply
        0
        • A Arun Immanuel

          Use Imagelist control.

          Regards, Arun Kumar.A

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

          ImageList supports only specific number of colors and sizes which cause too many headaches. just create a List or Collection or Image[] myImageList = new Image[] {img1, img2, img3}; And then in a loop, Button.Click event or Timer.Tick event use this code: protected void UpdateImage(Image newImage) { //un-comment below lines if you are reading images from disk to prevent memory leaks //if(myPictureBox.Image != null) //{ // myPictureBox.Image.Dispose(); // myPictureBox.Image = null; //} myPictureBox.Image = newImage; } OR protected void UpdateImage(IList myImageList, int newIndex) { myPictureBox.Image = myImageList[newIndex]; } Hope this helps...

          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