How can I embed images in my application and use them in HTML control?

Is there any way to embed images in my exe (as a resource?) And use it in the generated HTML?

Here are the requirements:

a. I want to show dynamic HTML content (for example, using the webBrowser control, VS 2008, VB.Net, winForm desktop)

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

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

and here is tricky:

E. All of these files (file1.xml, file2.xml, my.xsl, file1.gif, file2.gif) must be embedded in a single exe file.

I think XML and XSL can be embedded resources, and I can read them as a stream, but in what ways can I link to an image inside HTML?

<IMG src="???" /> 
  • I do not want to use the absolute path and external files.
  • If image files are resources, can a relative path be used? Regarding what? (I can use the BASE tag, and then what?)
  • Is it possible to use a 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.

  • What is the browser used by the webBrowser control?
  • IE?
  • which version?

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

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

  • Does it matter if I upgrade to VS 2010?

Thanks,

Atar

+4
source share
4 answers

to avoid problems with clients, I am going to use boxedApp or a similar tool.

http://www.boxedapp.com/

+3
source

The browser mechanism is the same as IE on your client computer, so its version depends on the version of IE client.

By default, image / gif, image / jpeg and image / pjpeg are supported natively. On my computer, image decoding filters for the image / BMP, image / x-icon, image / png and image / x-wmf are also supported. However, you probably want to stick to your own formats. I'm not sure if these filters are tested for the res protocol if you change the base URL of the images in the HTML output.

The Webbrowser classes in Windows Forms, WPF, and Silverlight are IE web browser management shells (MSHTML in the IE SDK refers to the DOM implementation and refers to MSHTML ActiveX hosting as a web browser control). If you use MSHTML directly, you need to write your own user interface that does not meet your requirements.

All your calls to the IE engine are handled by the IE API. Installing Visual Studio 2010 on your development computer will not change the behavior of the IE API on your client machines.

+2
source

As for me, I would like to use boxedapp too.

+2
source

to avoid problems with clients, I am going to use boxedApp or a similar tool.

http://www.boxedapp.com/

Thanks. This is useful to me)

+2
source

Source: https://habr.com/ru/post/1312433/


All Articles