0
我在窗体上有一个webbrowser控件。我能够在该控件中显示html文件。但我的网页包含一些图像,如果我给绝对路径然后图像显示。但是,如果我给相对路径,那么图像不会显示在页面中。
我有HtmlPages文件夹位于bin文件夹。
,我分配webbrowser控件查看html文件的图像路径问题
FileStream source = new FileStream(@"..\HtmlPages\supportHtml.html", FileMode.Open, FileAccess.Read);
webBrowser.DocumentStream = source;
如果我给你D:\myapp\bin\HtmlPages\file.png
那么就没有问题。 我的图像存储在同一个文件夹中。如果我用webbrowser打开html文件,然后显示图像。
什么是正确的路径设置?
http://stackoverflow.com/questions/1797469/c-webbrowser-building-a-document-with-text-and-images-from-streams的可能重复 – 2010-04-21 16:53:58