在 Webbrowser 控件中使用本地图像 [英] Use local images in Webbrowser control

查看:42
本文介绍了在 Webbrowser 控件中使用本地图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Wp7 应用程序中使用 Webbrowser Control,但我似乎无法将 App 目录中的图像放入 Webbrowser.

I'm using a Webbrowser Control in my Wp7 app, but I can't seem to put images that are in the App directory, in the webbrowser.

我已将一些图像放在与 .cs 和 .xaml 文件位于同一目录的文件夹中.现在我尝试将它们放在 webbrowser 控件中,但我似乎无法让它工作.

I've put some images in a folder in the same directory as the .cs and .xaml files. Now I try to put them in the webbrowser control, but I can't seem to get this to work.

<img src="images/photo.jpg"/>
<img src="/images/photo.jpg"/>

上面两个显然不行,我猜应该是这样的:

The two above obviously don't work, my guess is that it should be something like this:

<img src="/SilverlightApplication;component/photo.jpg"/>

SilverlightApplication"和component"应该用别的东西代替,但我不知道是什么:(

"SilverlightApplication" and "component" should be replaced by something else, but I don't know what :(

推荐答案

您需要将图像存储在独立存储中,然后从那里显示图像.我整理了一个示例,您可以从以下位置下载:-

You will need to store your images in the Isolated Storage and then display the images from there. I have put together a sample that you can download from the following location :-

www.smartmobiledevice.co.uk/projects/webbrowserimagesample.zip

这是基于 MSDN 文章 如何:使用适用于 Windows Phone 的 WebBrowser 控件显示静态 Web 内容.

This is based on the MSDN article How to: Display Static Web Content Using the WebBrowser Control for Windows Phone.

这篇关于在 Webbrowser 控件中使用本地图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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