winform 中webBrowser 控件显示网页的一部分,比如在webBrowser只显示淘宝的登录窗口。网上个的解决发案我都试了。不怎么对;
求大虾帮忙,谢谢
复制图片到剪贴板,在从剪贴板获取验证码.
HTMLDocument html = (HTMLDocument)this.webBrowser1.Document.DomDocument;
IHTMLControlElement img = (IHTMLControlElement)webBrowser1.Document.Images[2].DomElement;//没有ID,只能通过索引。后期通过正则来确定是第几个<img>
IHTMLControlRange range = (IHTMLControlRange)((HTMLBody)html.body).createControlRange();
range.add(img);
range.execCommand("Copy", false, null);
img = null;
range = null;
html = null;
if (Clipboard.ContainsImage())
{
this.pictureBox1.Image = Clipboard.GetImage();
}
else
{
MessageBox.Show("执行不成功");
}
Clipboard.Clear();
在网上弄下了。还是网上的大虾么厉害