如何在应用程序中嵌入图像并在HTML控件中使用它们?

[英]How can I embed images within my application and use them in HTML control?


Is there any way I can embed the images within my exe (as resource?) and use it in generated HTML ?

我是否可以将图像嵌入到exe中(作为资源?)并在生成的HTML中使用?

Here are the requirements:

这是要求:

A. I want to show dynamic HTML content (e.g. using webBrowser control, VS 2008, VB .Net, winForm desktop application)

A.我想展示动态HTML内容(例如使用webBrowser控件,VS 2008, VB .Net, winForm desktop application)

B. I want to generate the HTML on-the-fly using XML and XSL (file1.xml or file2.xml transformed by my.xsl)

我想使用XML和XSL(文件1)动态生成HTML。xml或file2。由my.xsl xml转换)

C. The HTML may contain IMG tags (file1.gif and or file2.gif according to the xml+xsl transformation)

C. HTML可能包含IMG标签(文件1)。gif或file2。gif根据xml+xsl转换)

and here comes the complicated one:

这里有一个复杂的问题:

D. All these files (file1.xml, file2.xml, my.xsl, file1.gif, file2.gif) should be embedded in one exe file.

D.所有这些文件(文件1。xml、file2。xml,我。xsl,file1。gif、file2.gif)应该被嵌入到一个exe文件中。

I guess the XML and XSL can be embedded resources, and I can read them as stream, but what ways do I have to reference the image within the HTML ?

我想XML和XSL是可以嵌入资源的,我可以将它们作为流来读取,但是我要用什么方法来引用HTML中的图像呢?

<IMG src="???" />
  • I do not want to use absolute path and external files.
  • 我不想使用绝对路径和外部文件。
  • If the image files are resources, can I use relative path? Relative to what? (I can use BASE tag, and then what?)
  • 如果图像文件是资源,我可以使用相对路径吗?相对于什么?(我可以用BASE tag,然后呢?)
  • Can I use stream as in email messages? If so, where can I find the format I need to use?
  • 我可以像在电子邮件中那样使用流吗?如果有,我可以在哪里找到我需要使用的格式?

http://www.websiteoptimization.com/speed/tweak/inline-images/ are browser dependent.

浏览器http://www.websiteoptimization.com/speed/tweak/inline-images/是相关的。

  • What is the browser used by webBrowser control?
  • 什么是浏览器使用的webBrowser控件?
  • IE?
  • IE ?
  • what version?

    什么版本?

  • Does it matter if I use GIF or JPG or BMP (or any other image format) for the images?

    如果我使用GIF或JPG或BMP(或任何其他图像格式)的图像,有关系吗?

  • Does it matter if I use mshtml library and not the regular webBrowser control? (currently I use http://www.itwriting.com/htmleditor/index.php )

    如果我使用mshtml库而不是常规的webBrowser控件,这有关系吗?(目前我使用http://www.itwriting.com/htmleditor/index.php)

  • Does it matter if I upgrade to VS 2010 ?

    我升级到VS 2010有关系吗?

Thanks,

谢谢,

Atara

Atara

4 个解决方案

#1


3  

to avoid customers problem I am going to use boxedApp or a similiar tool.

为了避免客户问题,我将使用boxedApp或者类似的工具。

http://www.boxedapp.com/

http://www.boxedapp.com/

#2


2  

The browser engine is the same with the IE on your customer's computer, so its version depends on the client's IE version.

浏览器引擎和客户电脑上的IE是一样的,所以它的版本取决于客户的IE版本。

By default image/gif, image/jpeg, and image/pjpeg are supported natively. On my computer, image decode filters for image/bmp,image/x-icon, image/png and image/x-wmf are also supported. You probably want to stick to the native formats though. I am not sure those filters are tested for the res protocol in case you change the base url of images in your HTML output.

默认情况下,本机支持图像/gif、图像/jpeg和图像/pjpeg。在我的计算机上,也支持图像/bmp、图像/x图标、图像/png和图像/x-wmf的图像解码过滤器。不过,您可能想要坚持使用本机格式。如果您在HTML输出中更改图像的基本url,我不确定是否对这些过滤器进行了res协议的测试。

The Webbrowser classes in Windows Forms, WPF and Silverlight are all wrappers of IE's webbrowser control (MSHTML in IE SDK refers to the DOM implementation and refer the ActiveX hosting MSHTML as the webbrowser control). If you use MSHTML directly then you need to write your own UI, which does not fit your requirement.

Windows窗体、WPF和Silverlight中的Webbrowser类都是IE的Webbrowser控件的包装器(IE SDK中的MSHTML表示DOM实现,并将ActiveX托管的MSHTML作为Webbrowser控件)。如果您直接使用MSHTML,那么您需要编写自己的UI,这并不符合您的需求。

All your calls to IE's engine are handled by IE's APIs. Installing Visual Studio 2010 on your developer machine will not change IE API's behavior on your customer's machines.

对IE引擎的所有调用都由IE的api处理。在开发者机器上安装Visual Studio 2010不会改变你客户机器上IE API的行为。

#3


2  

As for me I would like to use boxedapp too .

至于我,我也想用boxedapp。

#4


2  

to avoid customers problem I am going to use boxedApp or a similiar tool.

为了避免客户问题,我将使用boxedApp或者类似的工具。

http://www.boxedapp.com/

http://www.boxedapp.com/

Thank you. It useful for me)

谢谢你!对我来说有用的)


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/06/10/692552fa6aa08b2466ffcf614a1a2a98.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com