设置带有透明PNG的背景图片 [英] Set an background image with transparent PNG
问题描述
你好,
我有一个粗糙的图像,必须将其设置为表单的backgroundimage.我还必须在表单中添加组件.我无法摆脱透明阴影-即使在使用BackColor和TransparentKey并不是最好的帮助之后,它也仍然以表格的形式出现.
我发现带有C#的透明度教程 [解决方案
我唯一能建议的是,您的png图像没有以具有透明颜色/属性的方式保存.
Hello,
I have a shapy image that I got to set as backgroundimage of the form. I also got to add components to the form. I can''t get rid of the transparent shade - that appears as it is in the form even after using BackColor and TransparentKey is not being of best help.
I found Tranparency Tutorial with C#[^] helpful. Even if I drag my image to it, it shows perfectly well. I was trying hard to implement the same in my form, but couldn''t do it. If I inherit my form from PerPixelAlphaForm
class or add Win32 class to my Form class, I could''t have access to the designer nor it works also.
I also tried with adding a panel to the form and setting image to the panel and work on it. That improves the image''s transparency but doesn''t get the best results as Transparency Tutorial shows.
How do I implement it to make work on my Form i.e. set my form''s backgroundImage using UpdateLayeredWindow ?? Kindly try to help me out. I have been trying to accomplish this from last 2 days, but have been failed so far.
Looking forward for your help. Any help is highly appreciated.
Thanks
The only thing I can suggest is that your png image wasn''t saved in such a way as to have a transparency color/attribute.
这篇关于设置带有透明PNG的背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!