Windows Forms Glass Effect, Make ImageBox transparent

柔情痞子 提交于 2019-12-12 01:34:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!