views:

62

answers:

2

Hi - I have a windows form application, and I have extended the window's frame into the client area using DwmExtendFrameIntoClientArea to get the glass effect.

Now I'm trying to show a transparent PNG image in a picture box, however the background shows up as white instead of the glass effect. How can i make the image show as transparent so that i only see the rounded gray rectangle and not the white background.

My screenshot is below. Thanks.

alt text

alt text

A: 

Make it whatever the colour key for the glass is: Black iirc.

Blam
make what black? set the Form transpareny key to black? I tried that it does not work.
ace
Also when i set the form transparency key, the form behaves weird...when i try to maximize or close it, it looses focus and just stays there, the buttons don't work. I then have to right click on the taskbar and close it from there
ace
+1  A: 

Ok, this is a kind of easy to fix problem with winforms.....what you have to do, like blam said is set the transparency key to something like: R:1, G:2, B:3...this makes everything inside your form drawn in that color transparent...all you need to do then is set the background color of your imagebox to that color...and it should draw the image's background transparently (as long as your image has transparency)

Richard J. Ross III
I made my form transparency key to Black, which is what i'm using to get the glass effect. Then i also set the picturebox background color to black. But it didn't work.I'm 99.9% sure my PNG is transparent. On the desktop it correctly shows as transparent.
ace
I added my picturebox image to the question, it is transparent.
ace
that was the problem, your picture wasn't transparent...here's the link to the transparent picture, download it and try using that.http://img831.imageshack.us/img831/8227/xkeyh.png
Richard J. Ross III
oh cool that worked...what setting do you use to set the transparency of the image? I used fireworks, and while exporting the image chose transparency...wierd... thanks man.
ace
your welcome! i use a free program called paint.Net...you can get it at www.getpaint.net its like photoshop, but its free i just copied your image and i used my magic wand to select the white border and press delete and viola! save and transparent!
Richard J. Ross III