我搜索谷歌,发现几行代码可以做到这一点。这是代码
using Microsoft.mshtml;
....
{
...
// To Remove
HTMLDocumentClass htmldoc = wbCtrl.Document.DomDocument as HTMLDocumentClass;
IHTMLDOMNode node = htmldoc.getElementById("xBar") as IHTMLDOMNode;
node.parentNode.removeChild(node);
...
}
我收到 mshtml 参考错误,但我从这个路径C:\Program Files\Microsoft.NET\Primary Interop Assemblies 添加库并添加名为 Microsoft.mshtml.dll 的 dll
但仍然有错误。所以帮我添加什么,结果我可以使用上面的代码。我正在运行我的应用程序 VS2010 IDE。