日期:2014-05-19  浏览次数:21038 次

[200分求教高人]如何通过HTML代码得到图片对象
比如现在我有一个字符串(实际上是Html代码)
然后我通过这个字符串得到图片image对象。
请哪位高人提供解决方案~~

HTML如何解析成图片数据是个难点。
给出具体代码最好。

------解决方案--------------------
????

请举例说明什么叫“通过这个字符串得到图片image对象”
------解决方案--------------------
"[^\1]* <img [^> ]*src=([ '| " "])([^ " " ']+)\1[^> ]*> [^\1]* "
------解决方案--------------------
Joy_Zhao(面具) ( ) 信誉:100 Blog 2007-04-03 16:21:58 得分: 0


怪我没说清楚,对不起啦,浪费各位高手的时间。
目前我想是做一个打印功能,而打印部分需要动态得到Html,
所以会存到一个字符串变量里,我是想得到一个image对象,显示的就是html解析成网页的样子。
如:image img = GetImageFromHtml(string html)


----------------------------------------------
是要实现这样的效果吗?
http://www.3lian.com/zl/114/ok6.htm
------解决方案--------------------
你的需求是不是这样?

假设有一个字符串,内容是 " <table> ... </table> "

然后你最终想得到一张图片,这个图片就是那个字符串所呈现的表格?

------解决方案--------------------
html -> image
ref:http://www.codeproject.com/internet/htmlimagecapture.asp
------解决方案--------------------
http://www.codeproject.com/vcpp/gdiplus/WebPageSnapshot.asp

http://www.codeproject.com/aspnet/aspnethtml2mht.asp
------解决方案--------------------
http://www.cnblogs.com/hellosnoopy/archive/2004/09/21/45074.aspx


IHTMLDocument2 HTMLDocument =(IHTMLDocument2) web.Document;
IHTMLElementCollection links = HTMLDocument.images;

foreach (mshtml.HTMLImgClass el in links)
{ MessageBox.Show(el.src); }