透明的图片盒!!!!!!!!! 1 [英] Transparent picturebox !!!!!!!!!1

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

问题描述

我有带有透明图片框的申请表....

这样就显示出表单的背后是什么....

我想知道如何防止这种情况

I have application form with transparent picturebox....

so it show what is behind the form....

i want to know how to prevent this

推荐答案

可能是因为图片框的背景色也被指定为表单的透明色.

因此,请确保表单未指定要呈现为透明的颜色.

如果确实需要不规则形状的窗口和图片框,则必须使用图片中确实存在的颜色作为表单的透明键.

如果需要更为复杂,则可能需要使用多个窗口或WPF(或直接使用Windows API),因为WinForms在该区域受到一定限制.
Probably because the background color of the picture box is also specified as the transparent color of the form.

So ensure that the form do not specify a color to render as transparent.

If you do want irregular shaped windows and a picture box, then a color that does exist in the picture must be used for the transparency key of the form.

If need are more complex, you might have to uses multiple windows or WPF (or maybe use Windows API directly) as WinForms are somewhat limited in that area.


透明图像(带有PNG 24和透明度(带有透明度的Gif),在窗体上的PictureBox中将在其透明区域中显示窗体的BackgroundColor,如果放置在其他控件(如TextBox)上,例如,您的图像中的区域认为透明"会使用BackGroundColor表单覆盖其他控件.

图像中透明区域将显示表格后面"的唯一方法是,如果您为表格本身设置了透明键属性,并且其颜色与您为PictureBox设置的背景色相同.

例如,WinForms并不像WPF那样真正支持真正的透明度". Web上有很多文章展示了各种技巧,可以使WinForms获得不同类型的透明度,从使用自定义绘画事件到使用具有某些SetStyle选项集的面板.有一些使用透明Form覆盖和特殊Windows API调用的特殊解决方案.

在CP上签出:[
A transparent image (PNG 24 with transparency, Gif with transparency), in a PictureBox on a Form is going to show the Form''s BackgroundColor in its transparent areas, and, if placed over other controls, like a TextBox, for example, the areas in your Image you may think are "transparent" will cover the other controls with the Form BackGroundColor.

The only way the transparent areas in the image will show what is "behind the Form" is if you have set a Transparency Key property for the Form itself with the same Color as the BackGround Color you have set for the PictureBox.

WinForms does not really support "true transparency" in the way WPF does, for example. There are lots of articles on the web showing various tricks to get different types of transparency into WinForms, ranging from using Custom Paint Events to using Panels with certain SetStyle options set. There are exotic solutions using transparent Form overlays, and special Windows API calls.

Check out, here on CP: [^].

imho, you are generally wasting time to try and get sophisticated transparency effects in WinForms.


这篇关于透明的图片盒!!!!!!!!! 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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