/// <summary> /// Opens an Xml file and loads it up using BasicHostLoader (inherits from /// BasicDesignerLoader) /// </summary> public HostControl GetNewHost(string sClass, string formName) { HostSurface hostSurface = (HostSurface)this.CreateDesignSurface(this.ServiceContainer); IDesignerHost host = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost)); BasicHostLoader basicHostLoader = null; if (SaveLoadLayout.TestFormat(formName) == false) { basicHostLoader = new BasicHostLoader(GetType(sClass, formName), formName); } else { basicHostLoader = new BasicHostLoader(formName); } hostSurface.BeginLoad(basicHostLoader); hostSurface.Loader = basicHostLoader; hostSurface.Initialize(); return(new HostControl(hostSurface)); }
internal void InitializeHost(HostSurface hostSurface) { try { if (hostSurface == null) { return; } _hostSurface = hostSurface; Control control = _hostSurface.View as Control; control.Parent = this; control.Dock = DockStyle.Fill; control.Visible = true; } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } }
public HostControl(HostSurface hostSurface) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); InitializeHost(hostSurface); }