Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IHTMLDocument2并不适用于任何地方_C#_Ihtmldocument2 - Fatal编程技术网

C# IHTMLDocument2并不适用于任何地方

C# IHTMLDocument2并不适用于任何地方,c#,ihtmldocument2,C#,Ihtmldocument2,在winform应用程序中,我有WebBrowser控件和PictureBox。我在DocumentComplete之后从webbrowser控件加载一个图像到pictureBox1,代码如下 IHTMLDocument2 doc = (IHTMLDocument2)webBrowser1.Document.DomDocument; IHTMLControlRange imgRange = (IHTMLControlRange)((HTMLBody)doc.body).createControl

在winform应用程序中,我有WebBrowser控件和PictureBox。我在DocumentComplete之后从webbrowser控件加载一个图像到pictureBox1,代码如下

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);

     }
图像在我的电脑上以picturebox1显示,但在我朋友的电脑上不显示。在另一个windows XP上,它在安装VS2008后运行良好。所以我想IHTMLDocument2需要windows更新才能正常工作


这是哪一个更新?或者任何其他不必从internet重新下载映像的代码替代方案?

听起来您需要部署其他文件DLL?可用

最好的选择和大多数人所做的是使用类似的工具下载源代码,然后再次使用WebClient下载图像


如果决定使用HTML IHTMLDocument2接口,则如果运行32位Windows,则包含此接口的文件位于C:\Program Files x86\Microsoft.NET\Primary Interop Assemblys\Microsoft.mshtml.dll中,而不包含x86。如果您使用的是VS部署项目,请将此文件包括在项目中,或者手动将其复制到正在运行的应用程序目录。

我在链接上找不到任何DLL。您在谈论什么?