lundi 30 mars 2015

WebBrowser control not showing .jpg image c# winforms

I am making Html on runtime and i assign to a WebBrowser control using the code below:



webBrowser1.Navigate("about:blank");
HtmlDocument doc = this.webBrowser1.Document;
doc.Write(String.Empty);
webBrowser1.DocumentText = htmlText;


The issue is the WebBrowser Control does not show jpg image . On my html i am making user Images which reside locally on my computer so i am using the following code as a test :



SomeHtml="<img width=\"70\" height=\"50\" src=\"" + picture + "\" />";


Where Picture is:



picture = "file:///" + startPath + "/" + picture.Replace("\\", "/");


The paths are all good i test it with two images both exist on the folder are the same pictures one is JPG and other is PNG.



Image paths:

/images/student_pictures/noimage.png
/images/student_pictures/noimage.jpg


For the above when i use .png the images appear on the WebBrowser control in case of .jpg i see the red cross.


Any suggestion ?


Aucun commentaire:

Enregistrer un commentaire