简体   繁体   English

Webbrowser控件与透明背景

[英]Webbrowser control with Transparent background

I am working on Windows phone 8 app. 我正在使用Windows phone 8应用程序。

This is my code: 这是我的代码:

i am binding the data in the XAML: 我绑定XAML中的数据:

<phone:WebBrowser  IsScriptEnabled="True"
                                       ScriptNotify="BrowserControlScriptNotify"
                                       ListBoxWebView:WebBrowserUtility.Html="{Binding WebView}"/>

here WebView is the data binded to webbrowser control . 这里WebViewdata binded to webbrowser controldata binded to webbrowser control

I have the content like this: 我有这样的内容:

<html><head>{0}</head><body bgcolor=BGCOLOR style=\"margin:0px;padding:0px;\" "

here bgcolor=BGCOLOR i want the bgcolor to be transparent. 这里bgcolor=BGCOLOR我希望bgcolor是透明的。

i have tried <body style="background: transparent; margin: 0; padding: 0;"> but its not working. 我试过<body style="background: transparent; margin: 0; padding: 0;">但它不起作用。

As per the answer I gave here (and you've seen), it is not possible to make the background of a webbrowser control transparent. 根据我在这里给出的答案(你已经看过),不可能使web浏览器控件的背景透明。

As an alternative, you could use an image of the page without the webbrowser control displayed as the background of the HTML page you're displaying. 作为替代方法,您可以使用页面图像,而不显示webbrowser控件作为您正在显示的HTML页面的背景。

A couple of provisos though: 但有几个附带条件:
Obviously this wouldn't work with a page that has content that moves or changes. 显然,这不适用于具有移动或更改内容的页面。
If the XAML page content isn't fixed then you'll need to create a bitmap of the screen to use as the background. 如果XAML页面内容未修复,则您需要创建屏幕的位图以用作背景。
You may have to be careful with the relative path to the image (from HTML). 您可能必须小心图像的相对路径(来自HTML)。
This is untested, by me, and just an idea. 这是我未经测试的,只是一个想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM