private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { HtmlDocument _document = webBrowser1.Document; _document.MouseLeave += new HtmlElementEventHandler(document_MouseLeave); IHTMLDocument2 currentDoc = (IHTMLDocument2)webBrowser1.Document.DomDocument; HTMLDocumentEvents2_Event iEvent = (mshtml.HTMLDocumentEvents2_Event)currentDoc; iEvent.ondblclick += new HTMLDocumentEvents2_ondblclickEventHandler(iEvent_ondblclick); } }
private void document_MouseLeave(object sender, HtmlElementEventArgs e) { HtmlElement element = e.FromElement; mshtml.HTMLElementEvents2_Event iEvent; iEvent = element.DomElement as mshtml.HTMLElementEvents2_Event; iEvent.ondblclick -=new HTMLElementEvents2_ondblclickEventHandler(iEvent_ondblclick); } bool iEvent_ondblclick(IHTMLEventObj pEvtObj) { if (pEvtObj.srcElement.innerText != null) { // // Stop navigation on current click if it contains link. // if (pEvtObj.srcElement.outerHTML.Contains("href")) webBrowser1.Stop(); IHTMLDocument2 doc2 = wbMainPage.Document.DomDocument as IHTMLDocument2; StringBuilder html = new StringBuilder(doc2.body.outerHTML); String substitution = "" + pEvtObj.srcElement.innerText + ""; html.Replace(pEvtObj.srcElement.outerHTML, substitution); doc2.body.innerHTML = html.ToString(); } return false; }
I am really very happy to visit your blog. Directly I am found which I truly need. please visit our website for more information
ReplyDeleteTop 5 Data Extraction Tools
ReplyDeleteI am really very happy to visit your blog. Directly I am found which I truly need. please visit our website for more information
Data Scraping Service in India 2022
Very Informative and creative contents. This concept is a good way to enhance the knowledge. thanks for sharing.
ReplyDeleteContinue to share your knowledge through articles like these, and keep posting more blogs.
And more Information Data scraping service in Australia