6.1 浏览器本身处理
static ChromiumWebBrowser() { if (CefSharpSettings.ShutdownOnExit) { Application.ApplicationExit += OnApplicationExit; } } private static void OnApplicationExit(object sender, EventArgs e) { Cef.Shutdown(); }
6.2 需要关闭浏览器负载程序时操作
try { browser.CloseDevTools(); browser.GetBrowser().CloseBrowser(true); } catch { } try { if (browser != null) { browser.Dispose(); Cef.Shutdown(); } } catch { }