In a winform application I have WebBrowser
control and a PictureBox
. I am loading an Image (from webbrowser control after DocumentComplete
) to pictureBox1 with the code below
IHTMLDocument2 doc = (IHTMLDocument2)webBrowser1.Document.DomDocument;
IHTMLControlRange imgRange = (IHTMLControlRange)((HTMLBody)doc.body).createControlRange();
foreach (IHTMLImgElement img in doc.images)
{
imgRange.add((IHTMLControlElement)img);
imgRange.execCommand("Copy", false, null);
pictureBox1.Bitmap = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
}
Image is displayed in picturebox1 on my pc, but not on my friend's. On another windows XP it worked well after installing VS2008. So I guess IHTMLDocument2 needs a windows update to work correctly.
Which update is that? Or any other alternative to this code in which i don't have to redownload image from internet?