C# 網頁按鈕回調form 函數

1.  綁定事件web

        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. 處理回調this

        private void HtmlElement1_MouseDown(Object sender, HtmlElementEventArgs e)
        {
            //MessageBox.Show((sender as HtmlElement).InnerText);
            this.Text = (sender as HtmlElement).InnerText;
        }
相關文章
相關標籤/搜索