GIF透明度不起作用! [英] GIF Transparency Not Working!

查看:338
本文介绍了GIF透明度不起作用!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家



这应该很容易回答。



我用过一些在线服务生成带有透明背景的加载条。



但它们在表格上不透明。



如果你想看看我的问题,我使用了 www.chimply.com/Generator#classic-spinner,animatedCircle [ ^ ]



请不要将此更改为删除商业广告,因为人们需要自己查看问题



我怎样才能做到这一点工作?



谢谢

Hey everyone

This should be simple to answer.

I used a few online services to generate loading bars with transparent backgrounds.

But they are not transparent on the form.

If you would like to see my problem, i used www.chimply.com/Generator#classic-spinner,animatedCircle[^]

Please do not change this to "Removed commercial advertising" as people need to see the problem for themselves

How can i make this work?

Thanks

推荐答案

它没有用,因为你看到了背景的图片框。图像可能是透明的,但图片框不是。



在Windows窗体应用程序中,控件不是透明的。如果将控件的BackColor设置为Transparent,则不会使控件透明。该控件实际上将使用包含它的控件的BackColor和Background图像属性,匹配它们。这给了ILLUSION透明度。这个问题是如果PictureBox坐在父控件的文本上,你就不会看到文本通过PictureBox,因为那不是容器控件背景的一部分。



为了让它工作,你必须自己控制,可能来自PictureBox并自己控制绘画。你需要做的一件事就是覆盖OnPaintBackground方法并让它什么都不做。



有点像这个 [ ^ ]。
It doesn''t work because you''re seeing the background of the picturebox. The image may be transparent, but the picturebox is not.

In Windows Forms apps, controls are not "transparent". If you set the BackColor of a control to "Transparent", it doesn''t make the control transparent. The control will actually use the BackColor and Background image properties of of control that contains it, matching them. This gives the ILLUSION of transparency. The problem with this is if the PictureBox is sitting over text in the parent control, you won''t see the text "come through" the PictureBox because that''s not part of the container controls background.

In order to get this to work, you''ll have to make your own control, probably deriving from PictureBox and control the painting yourself. One of thing you''ll have to do is to override the OnPaintBackground method and have it do nothing at all.

Kind of like this[^].


这篇关于GIF透明度不起作用!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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