How to make WebBrowser control with transparent background?

情到浓时终转凉″ 提交于 2019-12-10 10:19:20

问题


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.

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.

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

Any help would be greatly appreciated.


回答1:


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.



来源:https://stackoverflow.com/questions/2788684/how-to-make-webbrowser-control-with-transparent-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!