示例#1
0
        /// <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));
        }
示例#2
0
        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());
            }
        }
示例#3
0
 public HostControl(HostSurface hostSurface)
 {
     // This call is required by the Windows.Forms Form Designer.
     InitializeComponent();
     InitializeHost(hostSurface);
 }