[英]How to create Transparent ElementHost's in Winforms/WPF
long time lurker and self taught OOP and c# thanks in good majority to the great people here. 长期潜伏和自学的OOP和C#非常感谢这里的优秀人才。 99% of my problems I seem to find out by searching all over the net but I'm stuck with this one.
我似乎有99%的问题是通过网上搜索找到的,但我对此一无所知。
My problem is that I have a custom GUI where I'm stacking elementhost control elements that host WPF user controls. 我的问题是我有一个自定义GUI,在其中堆叠了承载WPF用户控件的elementhost控件元素。 I have successfully made these graphics appear and perform their behavior but they are not transparent with respect to each other.
我已经成功地使这些图形出现并执行了它们的行为,但是它们彼此之间并不透明。 I have stacked icons that overlap each other with a semi transparent edges where they should blend together.
我堆叠的图标相互重叠,并带有半透明的边缘,它们应融合在一起。 The icons were made in paint.net and indeed have correct graphics for transparency.
这些图标是在paint.net中制作的,确实具有正确的图形以提高透明度。 Using host.BackColorTransparency = true, I was able to make these element hosts transparent to background of my winforms GUI, but they are still not transparent with respect to each other.
使用host.BackColorTransparency = true,我能够使这些元素宿主对winforms GUI的背景透明,但是它们彼此之间仍然不透明。
I'm trying to be as descriptive as I can here. 我试图在这里尽可能地描述自己。 And since this is a work project I cannot display any proprietary information.
由于这是一个工作项目,因此我无法显示任何专有信息。 Please let me know if anyone needs any more information.
请让我知道是否有人需要更多信息。 Thank you for any help.
感谢您的任何帮助。
This MSDN article mentions a trick called 'bitmap copying'. 此 MSDN文章提到了一个称为“位图复制”的技巧。
Actually this means the ElementHost paints the background of the owner control to its own drawing surface. 实际上,这意味着ElementHost将所有者控件的背景绘制到其自己的绘图表面上。 This is a simple 1:1 relation.
这是一个简单的1:1关系。 It does not take the overlapping controls into account.
它没有考虑重叠的控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.