Results 1 to 5 of 5

Thread: [RESOLVED] Picturebox transparency problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    84

    Resolved [RESOLVED] Picturebox transparency problem

    Hello,

    I have multiple picturebox controls in my form.
    Both of them contain an image with a transparent background.
    I want them to be on top of each other.
    I've already set their BackColor property to Transparent, but when I place one on top of the other one, the following happens: http://tinypic.com/view.php?pic=2v284s0&s=5

    How can I make them transparent while they are on top of each other?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Picturebox transparency problem

    pictureboxes don't support transparent backgrounds.
    you need to draw the top image onto the bottom image + display the resulting image in 1 picturebox

  3. #3
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Re: Picturebox transparency problem

    I usually use the BackgroundImage property instead of the Image property.
    It seems like the BackgroundImage one supports/allows transparency.

    The image needs to be in a format which supports transparency though, such as PNG (which I always use) or perhaps GIF.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Picturebox transparency problem

    Quote Originally Posted by Zeelia View Post
    I usually use the BackgroundImage property instead of the Image property.
    It seems like the BackgroundImage one supports/allows transparency.

    The image needs to be in a format which supports transparency though, such as PNG (which I always use) or perhaps GIF.
    i think you mean overlay 1 picture on the other in 1 picturebox, using the backgroundimage + the image properties

  5. #5
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Re: Picturebox transparency problem

    Actually I don't mean that.
    Just pass the image you want to use to the BackgroundImage property instead of Image.
    I don't know why, but it works. Must be some flaw in the PictureBox control.

    I could be mistaken though since it was some time ago when I worked with an application with custom UI, but I believe it worked. If it doesn't, there sure are other ways to workaround the PictureBoxs' limitations, just as you wrote, Paul.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width