private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser WebCtl = webBrowser1; HTMLDocument doc = (HTMLDocument)WebCtl.Document.DomDocument; HTMLBody body = (HTMLBody)doc.body; IHTMLControlRange rang = (IHTMLControlRange)body.createControlRange(); IHTMLControlElement Img = (IHTMLControlElement)webBrowser1.Document.Images[0].DomElement; //图片地址 Image oldImage = Clipboard.GetImage(); rang.add(Img); rang.execCommand("Copy", false, null); //拷贝到内存 Image numImage = Clipboard.GetImage(); numImage.Save(string.Format("c:\\ID2\\{0}.jpg", ID)); string strID = ID--.ToString(); webBrowser1.Navigate(@"https://1.6.1.8/Image/?img=1&id=" + strID); }
时间: 2024-10-12 15:29:01