public void SwitchLayoutEngine(String id) { AxHost host = null; String url = "about:blank"; switch (id) { case "trident": if (gecko != null) { url = gecko.LocationURL; this.Controls.Remove(gecko as AxHost); gecko = null; } if (trident == null) { trident = new AxWebBrowser(); host = trident as AxHost; } break; default: if (trident != null) { url = trident.LocationURL; this.Controls.Remove(trident as AxHost); trident = null; } if (gecko == null) { gecko = new AxMozillaBrowser(); host = gecko as AxHost; } break; } if (host != null) { host.BeginInit(); host.TabIndex = 1; host.Dock = DockStyle.Fill; host.EndInit(); this.Controls.Add(host); } // Add appropriate content area listeners AddListeners(); ServiceManager.Preferences.SetStringPref("browser.layoutengine", id); LoadURL(url, false); }