问题
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.
回答1:
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)
回答2:
Make it whatever the colour key for the glass is: Black iirc.
来源:https://stackoverflow.com/questions/3539282/windows-forms-glass-effect-make-imagebox-transparent