Imagelist Destroys Background Transparency of Images!!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Imagelist Destroys Background Transparency of Images!!!

  1. #1
    James Graham Guest

    Imagelist Destroys Background Transparency of Images!!!


    I've got a problem with using images with transparent backgrounds.

    If I convert a bmp image to a png image (via a graphics editor...in this
    case Microsoft Photo Editor) and then place the png into a picturebox, the
    background is transparent and has the same color as the form background that
    the picture is place upon.

    Here's the problem.....

    If I have a number of png images loaded into an imagelist, and I retrieve
    one of those images into a picturebox rather than directly from a file, the
    background transparency seems to go away, and the background of the image
    is solid white.

    To Summarize:
    Saving an image with a transparent background as a .png format image file,
    then placing that file into a picturebox works (background is transparent).

    But putting that same .png image into an imagelist, then retreiving the image
    from the imagelist into a picturebox "breaks" the transparency.

    Is there a workaround for this or am I going to have to throw away the imagelist
    and opt for a resource file? Even worse, am I going to have to retreive
    the image from a disk file? I hope not. I've got 45 images to deal with!

    Thanks,
    Jim Graham
    --
    graham@iucf.indiana.edu


  2. #2
    Constance J. Petersen Guest

    Re: Imagelist Destroys Background Transparency of Images!!!

    Hi Jim,

    "James Graham" <graham@iucf.indiana.edu> wrote in message
    news:3c940f95$1@10.1.10.29...
    > If I have a number of png images loaded into an imagelist, and I retrieve
    > one of those images into a picturebox rather than directly from a file, the
    > background transparency seems to go away, and the background of the image
    > is solid white.


    I think your problem might be with the png created by Microsoft Photo Editor.

    I've tested this with a transparent png that I made with Macromedia Fireworks
    3.0, and transparency is preserved.
    --
    Constance Petersen, DevX newsgroup section leader
    SoftMedia Artisans, Inc.
    http://www.smartisans.com
    For useful, usable software and Web sites
    Featured Web design: http://www.keweenawnow.com/
    --
    Please reply in the newsgroup so everyone can benefit




  3. #3
    James Graham Guest

    Re: Imagelist Destroys Background Transparency of Images!!!


    Constance, thanks for your reply.

    I just discovered that it's not technically a problem, but I still can't
    explain why it's happening.

    As it turns out, the .png images in my imagelist are intact after all.

    What I had not checked when I composed my posting to this list was the BackColor
    of the control form. If I set my control's form backcolor to that of the
    parent application form's backcolor, all is well.

    The difference, which I can't explain, is that the background color of the
    image in my control during design-time OF THE CONTROL, is AUTOMATICALLY transparent
    to the usercontrol's form. Changing the usercontrol's form also appears
    "through" the background of the image I retreived from my imagelist.

    But....I have to deliberately SET the backcolor of my usercontrol when it's
    placed on another form. I can live with that, and I suspect it's perfectly
    normal....I just can't explain it .

    Thanks again,
    Jim Graham
    --
    graham@iucf.indiana.edu




    "Constance J. Petersen" <constance@smartisans.com> wrote:
    >Hi Jim,
    >
    >"James Graham" <graham@iucf.indiana.edu> wrote in message
    >news:3c940f95$1@10.1.10.29...
    >> If I have a number of png images loaded into an imagelist, and I retrieve
    >> one of those images into a picturebox rather than directly from a file,

    the
    >> background transparency seems to go away, and the background of the image
    >> is solid white.

    >
    >I think your problem might be with the png created by Microsoft Photo Editor.
    >
    >I've tested this with a transparent png that I made with Macromedia Fireworks
    >3.0, and transparency is preserved.
    >--
    >Constance Petersen, DevX newsgroup section leader
    >SoftMedia Artisans, Inc.
    >http://www.smartisans.com
    >For useful, usable software and Web sites
    >Featured Web design: http://www.keweenawnow.com/
    >--
    >Please reply in the newsgroup so everyone can benefit
    >
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center