具有透明背景的 Web 浏览器控件 [英] Webbrowser control with Transparent background

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

问题描述

我正在开发 Windows Phone 8 应用程序.

I am working on Windows phone 8 app.

这是我的代码:

我正在绑定 XAML 中的数据:

i am binding the data in the XAML:

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

这里的WebView绑定到浏览器控件的数据.

我有这样的内容:

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

这里 bgcolor=BGCOLOR 我希望 bgcolor 是透明的.

here bgcolor=BGCOLOR i want the bgcolor to be transparent.

我尝试过 <body style="background: transparent; margin: 0; padding: 0;"> 但它不起作用.

i have tried <body style="background: transparent; margin: 0; padding: 0;"> but its not working.

推荐答案

根据我在here(和你已经看到了),不可能使 webbrowser 控件的背景透明.

As per the answer I gave here (and you've seen), it is not possible to make the background of a webbrowser control transparent.

作为替代方案,您可以使用不显示 webbrowser 控件的页面图像作为您正在显示的 HTML 页面的背景.

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.

不过有几个条件:
显然,这不适用于内容移动或更改的页面.
如果 XAML 页面内容未修复,则您需要创建屏幕位图以用作背景.
您可能需要注意图像的相对路径(来自 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.
You may have to be careful with the relative path to the image (from HTML).
This is untested, by me, and just an idea.

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

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