c#给webBrowser添加click事件
作者:佚名 时间:2012-05-28
c#网站建设给webBrowser添加click事件
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument htmlDoc = webBrowser1.Document;
htmlDoc.Click+=new HtmlElementEventHandler(htmlDoc_Click);
}
private void htmlDoc_Click(object sender, HtmlElementEventArgs e)
{
HtmlDocument doc = sender as HtmlDocument;
HtmlElement ele = doc.GetElementFromPoint(e.ClientMousePosition);
MessageBox.Show(ele.OuterHtml);
}
如没特殊注明,文章均为上海联楷网络原创,转载请注明来自:http://www.linksj.com/contact/20151229/n7547.html