如何在透明winform上使用透明图像作为背景?
我有一个 C# 语言的 WinForm,我将 BackCOlor 和 TransparencyKey 设置为颜色“Lime”。如果我此时进行编译,则表单是透明的。然后我添加了一个带有石灰背景的BackgroundImage(#00ff00),但是图像上的石灰不透明。
如何使背景图像也具有透明背景?
我使用的图像是 .bmp
I have a WinForm in C#, I have both BackCOlor and TransparencyKey set to color "Lime". If I compile at this point the form is transparent. Then I added an BackgroundImage with a Lime background (#00ff00), but the Lime on the image is not transparent.
How can I get the background image to have a transparent background too?
The image I used is a .bmp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我很确定图片中的石灰颜色与您设置为 TransparencyKey 的石灰颜色不同。
使用 ColorPicker:http://www.iconico.com/download.aspx? app=ColorPic&type=free
在您的图片上查看图片中石灰的颜色代码:例如#XXXXXX。
然后将该数字放入 TransparencyKey,不要只使用“Lime”。
I'm pretty sure the Lime color in the picture is not identical to Lime you set as TransparencyKey.
Use ColorPicker: http://www.iconico.com/download.aspx?app=ColorPic&type=free
over your picture to see what color code the lime in the picture has: e.g. #XXXXXX.
Then put that number in TransparencyKey, don't just use "Lime".
使用支持透明度的图像格式,例如 PNG。
Use an image format that supports transparency such as PNG.
这对我有用。您确定 BMP 的背景颜色与您的表单完全相同,并且没有以某种方式进行更改,可能是通过减少颜色数量或类似的方式进行的?
It works for me. Are you sure that the BMP has exactly the same background color as your form, and that it has not been altered some way, perhaps by a reduction in the number of colors or something similar?