C# 网页按钮回调form 函数

1.  绑定事件

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            foreach (System.Windows.Forms.HtmlElement el in this.webBrowser1.Document.GetElementsByTagName("a"))
            {
                //if (el.Name == " btnG ")
                {
                    el.Click += new HtmlElementEventHandler(HtmlElement1_MouseDown);
                }
            }
        }

2. 处理回调

        private void HtmlElement1_MouseDown(Object sender, HtmlElementEventArgs e)
        {
            //MessageBox.Show((sender as HtmlElement).InnerText);
            this.Text = (sender as HtmlElement).InnerText;
        }

  

 

posted @ 2018-02-03 15:30  睡觉的虫  阅读(543)  评论(0编辑  收藏  举报