不继承最高形式的不透明度 [英] Not inherrit topmost form opacity

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

问题描述

如果我设置最顶层表单的不透明度,则所有子控件都将与表单一样透明.使用透明键时,所有子控件都具有相同的透明颜色.

If I set the opacity of the topmost form all the sub-controls are just as transparent as the form. The same goes for when using the transparencyKey, all the sub-controls have the same transparent color.

要在表单上具有控件并有选择地选择要继承此属性的内容,我希望完成此操作.即使需要在表单中添加子表单,也可以这样做吗?

What I wish to accomplish it to have controls on the form and selectively choose which should inherit this property. Is it possible to do this even if it would require adding subforms to the form?

任何帮助/建议都将不胜感激,因为我找不到适合我的解决方案.

Any help/suggestions would be appreciated, since I couldn't find any solution that worked for me.

推荐答案

不,这通常是不可能的,因为它不是特定于c#的,而是Microsoft Windows的工作方式.

No, this is generally not possible, because it is not specific to c#, but the way Microsoft Windows works.

有两种方法可以在Windows上获得适当的透明度:WS_EX_LAYERED和WS_EX_NOREDIRECTIONBITMAP.两者都无法使用Winforms进行访问,并且有充分的理由:您将必须自己进行任何绘画,包括子控件.

There are 2 ways to get proper transparency on Windows: WS_EX_LAYERED and WS_EX_NOREDIRECTIONBITMAP . Both are inaccessible using Winforms and for good reason: You will have to do any and all painting yourself, including the subcontrols.

但是WPF确实支持此功能.

WPF does however support this natively.

这篇关于不继承最高形式的不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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