如何使 WebBrowser 控件具有透明背景? [英] How to make WebBrowser control with transparent background?

查看:58
本文介绍了如何使 WebBrowser 控件具有透明背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使我的 WebBrowser 控件透明,因此如果加载到其中的 HTML 没有背景,则底层窗口应该是可见的.尝试不同的方法,我已经头破血流了.

I try to make my WebBrowser control transparent, so if the HTML loaded into it has no background, the underlying window should be visible. I`ve broke my head trying different ways.

Microsoft Sidebar 应用程序中有透明背景.在小工具的 HTML 中标签可以使用,但是这个标签在普通的浏览器控件中是不可用的.

There is a transparent background in Microsoft Sidebar application. In gadget`s HTML <g:background> tag can be used, but this tag is not available in usual webBrowser control.

我也研究过 DirectX Transform 过滤器,它可以应用于 IE 中的 HTML 元素,但没有成功.

I`ve also investigate in DirectX Transform filters, which can be applied to the HTML elements in IE, but have no success.

任何帮助将不胜感激.

推荐答案

WebBrowser(又名 Internet Explorer)没有这样的功能.您必须将其托管在使用 WS_EX_LAYERED 样式标志的窗口中,并使用 SetLayeredWindowAttributes() 使颜色键与显示的 HTML 的背景相匹配.避免显示任何文本,当抗锯齿像素不再将字母与背景混合时,它会看起来很糟糕.

WebBrowser (aka Internet Explorer) has no such capabilities. You'd have to host it in a window that uses the WS_EX_LAYERED style flag and use SetLayeredWindowAttributes() to make the color key match the background of the displayed HTML. Avoid displaying any text, it is going to look bad when the anti-aliasing pixels no longer blend the letter with the background.

这篇关于如何使 WebBrowser 控件具有透明背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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