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. transparent pictureboxes in C#

transparent pictureboxes in C#

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpquestion
7 Posts 5 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.
  • U Offline
    U Offline
    Umangj
    wrote on last edited by
    #1

    language: C# I am trying to set a no. of pictureboxes containing an image( image being a transparent image) of its own. Is there any way to set these pictureboxes over one another so that the image of one picturebox below another picturebox can be seen( as the images set over them are transparent)????

    R T P L 4 Replies Last reply
    0
    • U Umangj

      language: C# I am trying to set a no. of pictureboxes containing an image( image being a transparent image) of its own. Is there any way to set these pictureboxes over one another so that the image of one picturebox below another picturebox can be seen( as the images set over them are transparent)????

      R Offline
      R Offline
      Rob Smiley
      wrote on last edited by
      #2

      You can't do this with pictureBoxes - even though the image contains transparent areas, the pictureBox will only show the background colour of the parent control (or anything you paint manually in the PaintBackground event of parent control). You may have better luck doing the painting yourself rather than relying on pictureBox - this will give you more control over what happens when you layer images like this.

      "An eye for an eye only ends up making the whole world blind"

      1 Reply Last reply
      0
      • U Umangj

        language: C# I am trying to set a no. of pictureboxes containing an image( image being a transparent image) of its own. Is there any way to set these pictureboxes over one another so that the image of one picturebox below another picturebox can be seen( as the images set over them are transparent)????

        T Offline
        T Offline
        Tristan Rhodes
        wrote on last edited by
        #3

        I agree with the previous poster, It would be better to have a list of images in your form and to draw them all to a single picture box inside the PictureBox Paint event handler.

        ------------------------------- Carrier Bags - 21st Century Tumbleweed.

        1 Reply Last reply
        0
        • U Umangj

          language: C# I am trying to set a no. of pictureboxes containing an image( image being a transparent image) of its own. Is there any way to set these pictureboxes over one another so that the image of one picturebox below another picturebox can be seen( as the images set over them are transparent)????

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          The best thing you can do is layer these images in memory, and then write the combined image into a single picturebox.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          My blog | My articles | MoXAML PowerToys

          1 Reply Last reply
          0
          • U Umangj

            language: C# I am trying to set a no. of pictureboxes containing an image( image being a transparent image) of its own. Is there any way to set these pictureboxes over one another so that the image of one picturebox below another picturebox can be seen( as the images set over them are transparent)????

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, if you want to operate on images and don't know how to do it with a PictureBox, then it is very likely a PictureBox is not the right Control for the job. Consider using a Panel, and paint whatever it is you need in its Paint handler. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Fixturized forever. :confused:


            U 1 Reply Last reply
            0
            • L Luc Pattyn

              Hi, if you want to operate on images and don't know how to do it with a PictureBox, then it is very likely a PictureBox is not the right Control for the job. Consider using a Panel, and paint whatever it is you need in its Paint handler. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              Fixturized forever. :confused:


              U Offline
              U Offline
              Umangj
              wrote on last edited by
              #6

              can a panel open multiple images together.... if not then how to do it.. as i have more than 1 no. of transparent images to open :confused:??? if yes.... then i'll go forward with it..... Thank you all for replying.... ;)

              L 1 Reply Last reply
              0
              • U Umangj

                can a panel open multiple images together.... if not then how to do it.. as i have more than 1 no. of transparent images to open :confused:??? if yes.... then i'll go forward with it..... Thank you all for replying.... ;)

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                A Panel is a simple container, it is like a whiteboard with size, location, backcolor, etc. but it does not do anything; you have to load the images yourself and paint what you want to see. IMO Panel gets sufficiently explained in MSDN. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                Fixturized forever. :confused:


                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