Beispiel #1
0
        public void AddHostToTabManager(HostControl hc)
        {
            if (hc == null)
            {
                return;
            }
            hc.SuspendLayout();

            hc.HostSurface.UndoEngine.Enabled = true;
            hc.HostSurface.CanRedoChanged    += new EventHandler(OwnerStudio.HostSurface_CanUndoRedoChanged);
            hc.HostSurface.CanUndoChanged    += new EventHandler(OwnerStudio.HostSurface_CanUndoRedoChanged);

            #region Init Services

            if (hc.HostSurface.ServiceSelection != null)
            {
                hc.HostSurface.ServiceSelection.SelectionChanged += new EventHandler(SelectionService_SelectionChanged);
            }

            if (hc.HostSurface.ServiceComponentChange != null)
            {
                hc.HostSurface.ServiceComponentChange.ComponentChanged += new ComponentChangedEventHandler(ServiceComponentChange_ComponentChanged);
                hc.HostSurface.ServiceComponentChange.ComponentAdded   += new ComponentEventHandler(ComponentChangeService_OnComponentAdded);
                hc.HostSurface.ServiceComponentChange.ComponentRemoved += new ComponentEventHandler(ComponentChangeService_OnComponentRemoved);
            }

            #endregion

            hc.Dock = DockStyle.Fill;
            hc.HostSurface.UndoEngine.CleanEngine();

            hc.HostSurface.ServiceSelection.SetSelectedComponents(null);
            hc.HostSurface.ServiceSelection.SetSelectedComponents(new IComponent[] { hc.HostSurface.DesignerHost.RootComponent });
            hc.ResumeLayout(false);

            String strText = ((ABCControls.ABCView)hc.HostSurface.DesignerHost.RootComponent).Caption;
            DevExpress.XtraTab.XtraTabPage tabpage = OwnerStudio.TabViewControl.TabPages.Add(strText);
            tabpage.Tag  = hc;
            tabpage.Text = strText;
            hc.Parent    = tabpage;


            OwnerStudio.SurfaceManager.ActiveDesignSurface = hc.HostSurface;
            OwnerStudio.Toolbox.DesignerHost = hc.DesignerHost;
            OwnerStudio.CheckUndoRedo();
            OwnerStudio.ControlListsGrid.RefreshList();
            OwnerStudio.RefreshFieldBindingTree(true);

            OwnerStudio.TabViewControl.SelectedTabPage = tabpage;
            //     Application.DoEvents();

            //    InvalidatePropertyGrid();
        }