public IEBrowser(string target, UrlRatioMode ratio, AutoResetEvent resultEvent) { ResultEvent = resultEvent; Thread thrd = new Thread(new ThreadStart( delegate { Init(target,ratio); Application.Run(this); })); // set thread to STA state before starting thrd.SetApartmentState(ApartmentState.STA); thrd.Start(); }
public IEBrowser(string target, UrlRatioMode ratio, AutoResetEvent resultEvent) { ResultEvent = resultEvent; Thread thrd = new Thread(new ThreadStart( delegate { Init(target, ratio); Application.Run(this); })); // set thread to STA state before starting thrd.SetApartmentState(ApartmentState.STA); thrd.Start(); }
private void Init(string target, UrlRatioMode ratio) { // create a WebBrowser control _browser = new WebBrowser(); _browser.ScrollBarsEnabled = false; _browser.ScriptErrorsSuppressed = true; // set WebBrowser event handle _browser.DocumentCompleted += IEBrowser_DocumentCompleted; _ratio = ratio; if (target.ToLower().StartsWith("http:") || target.ToLower().StartsWith("https:")) { _html = ""; _browser.Navigate(target); } else { _browser.Navigate("about:blank"); _html = target; } }
private void Init(string target,UrlRatioMode ratio) { // create a WebBrowser control WebBrowser ieBrowser = new WebBrowser(); ieBrowser.ScrollBarsEnabled = false; ieBrowser.ScriptErrorsSuppressed = true; // set WebBrowser event handle ieBrowser.DocumentCompleted += IEBrowser_DocumentCompleted; _ratio = ratio; if (target.ToLower().StartsWith("http:")) { _html = ""; ieBrowser.Navigate(target); } else { ieBrowser.Navigate("about:blank"); _html = target; } }