日期:2014-05-18 浏览次数:20911 次
public Form27() { InitializeComponent(); this.webBrowser1.Navigate("http://localhost:9584/"); this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted); } void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //throw new NotImplementedException(); System.Windows.Forms.HtmlDocument HTMLDocument = this.webBrowser1.Document; System.Windows.Forms.HtmlElement list1 = HTMLDocument.GetElementById("ctl00$MainContent$btnClick"); list1.MouseDown += new HtmlElementEventHandler(closeWindw);// // 指定监视 } void closeWindw(object o, EventArgs e) { this.Close(); }
------解决方案--------------------
public void close() { this.close(); }