Windows窗体玻璃效果,使ImageBox透明 [英] Windows Forms Glass Effect, Make ImageBox transparent

查看:170
本文介绍了Windows窗体玻璃效果,使ImageBox透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体应用程序,并且我已使用DwmExtendFrameIntoClientArea将窗口的框架扩展到工作区中以获得玻璃效果.

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.

现在,我试图在图片框中显示透明的PNG图像,但是背景显示为白色而不是玻璃效果.如何使图像显示为透明,这样我只能看到圆角的灰色矩形而不是白色背景.

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.

推荐答案

好吧,这是一种易于解决的winforms问题.您必须执行的操作,就像blam所说的将透明键设置为诸如:R:1,G:2,B:3 ...这样可使您用透明颜色绘制的表单中的所有内容都变得透明...然后您需要做的就是将图像框的背景色设置为该颜色. .并且它应该透明地绘制图像的背景(只要您的图像具有透明度)

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)

这篇关于Windows窗体玻璃效果,使ImageBox透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆