【发布时间】:2013-09-09 10:08:49
【问题描述】:
我将VB.Net 应用程序转移到C# 并在我构建它时。出现了这个错误 -
'mshtml.IHTMLImgElement' 不包含对 'getattribute' 并且没有扩展方法 'getattribute' 接受 可以找到“mshtml.IHTMLImgElement”类型的第一个参数(是 您缺少 using 指令或程序集引用?)
那么我该如何替换这个getattribute 电话?
这是代码
private void captcha()
{
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2) WebBrowser1.Document.DomDocument;
mshtml.IHTMLControlRange imgrange = (mshtml.IHTMLControlRange) (((mshtml.HTMLBody) doc.body).createControlRange());
foreach (mshtml.IHTMLImgElement img in doc.images)
{
if (img.getattribute("src").ToString().Contains("urltoimg"))
{
imgrange.add((mshtml.IHTMLControlElement) img);
imgrange.execCommand("copy", false, null);
PictureBox1.Image = (System.Drawing.Image) (Clipboard.GetDataObject().GetData(DataFormats.Bitmap));
break;
}
}
}
【问题讨论】:
标签: c# vb.net image captcha getattribute