How can I embed images within my application and use them in HTML control?
Posted
by Atara
on Stack Overflow
See other posts from Stack Overflow
or by Atara
Published on 2010-06-10T12:16:09Z
Indexed on
2010/06/10
12:53 UTC
Read the original article
Hit count: 229
Is there any way I can embed the images within my exe (as resource?) and use it in generated 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)
B. I want to generate the HTML on-the-fly using XML and XSL (file1.xml or file2.xml transformed by my.xsl)
C. The HTML may contain IMG tags (file1.gif and or file2.gif according to the xml+xsl transformation)
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.
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 ?
<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?)
- 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.
- What is the browser used by webBrowser control?
- IE?
what version?
Does it matter if I use GIF or JPG or BMP (or any other image format) for the images?
Does it matter if I use mshtml library and not the regular webBrowser control? (currently I use http://www.itwriting.com/htmleditor/index.php )
Does it matter if I upgrade to VS 2010 ?
Thanks,
Atara
© Stack Overflow or respective owner