コード例 #1
0
        protected virtual void InitializeDockingControls( )
        {
            //	Create the docking manager
            m_DockingManager = new DockingManager( this, VisualStyle.IDE );
            m_DockingManager.InnerControl = display;
            m_DockingManager.OuterControl = statusStrip;

            //	Add log, property editor, and edit mode controls to the docking manager
            m_LogDisplayContent = m_DockingManager.Contents.Add( m_LogDisplay, "Log" );
            m_PropertyEditorContent = m_DockingManager.Contents.Add( new ObjectPropertyEditor( ), "Property Editor" );
            m_SelectionContent = m_DockingManager.Contents.Add( new SelectionControl( ), "Selection" );

            m_DockingManager.AddContentWithState( m_LogDisplayContent, State.DockBottom );
            m_DockingManager.AddContentWithState( m_SelectionContent, State.DockRight );
            m_DockingManager.AddContentWithState( m_PropertyEditorContent, State.DockLeft );

            m_EditModesContent = m_DockingManager.Contents.Add( new EditModesControl( ), Resources.EditModes );
            m_DockingManager.AddContentToZone( m_EditModesContent, m_SelectionContent.ParentWindowContent.ParentZone, 0 );
        }
コード例 #2
0
        public MainForm(string strOpenFileName)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_dkm = new DockingManager(this, VisualStyle.IDE);
            Globals.ActiveDocumentChanged += new EventHandler(OnActiveDocumentChanged);
            m_doc = Globals.ActiveDocument;
            Globals.MainForm = this;

            // Create all the "Contents" used to display the various animation components

            m_ctlPreviewPanel = new PreviewPanel(m_doc);
            Globals.PreviewControl = m_ctlPreviewPanel.PreviewControl;
            m_ctlPreviewPanel.Dock = DockStyle.Fill;
            Controls.Add(m_ctlPreviewPanel);
            m_dkm.InnerControl = m_ctlPreviewPanel;

            m_frmStrips = new StripsForm(m_doc);
            Globals.StripsForm = m_frmStrips;
            m_tntStrips = m_dkm.Contents.Add(m_frmStrips, m_frmStrips.Text);
            m_tntStrips.DisplaySize = new Size(ClientSize.Width / 4, ClientSize.Height / 2);
            m_wcStrips = m_dkm.AddContentWithState(m_tntStrips, State.DockLeft);

            m_frmBitmaps = new BitmapsForm(m_doc);
            m_tntBitmaps = m_dkm.Contents.Add(m_frmBitmaps, m_frmBitmaps.Text);
            m_tntBitmaps.DisplaySize = new Size(ClientSize.Width / 4, ClientSize.Height / 2);
            m_dkm.AddContentWithState(m_tntBitmaps, State.DockTop);

            // Add the Bitmaps form to the StripForm's Zone

            m_dkm.AddContentToZone(m_tntBitmaps, m_wcStrips.ParentZone, 1);

            m_frmFrames = new StripForm(m_doc);
            Globals.StripForm = m_frmFrames;
            m_tntFrames = m_dkm.Contents.Add(m_frmFrames, m_frmFrames.Text);
            m_frmFrames.Content = m_tntFrames;
            int cx = ClientSize.Width - (ClientSize.Width / 4);
            int cy = ClientSize.Height / 3;
            m_tntFrames.DisplaySize = new Size(cx, cy);
            m_dkm.AddContentWithState(m_tntFrames, State.DockBottom);

            m_frmCombiner = new CombinerForm();
            m_tntCombiner = m_dkm.Contents.Add(m_frmCombiner, m_frmCombiner.Text);
            m_tntCombiner.DisplaySize = new Size(ClientSize.Width / 2, ClientSize.Height / 2);
            //			m_dkm.AddContentWithState(m_tntCombiner, State.Floating);
            //			m_dkm.HideContent(m_tntCombiner);

            // Do a little wiring

            ((StripControl)Globals.StripControl).FrameOffsetChanged +=
                    new FrameOffsetEventHandler(((PreviewControl)Globals.PreviewControl).OnFrameOffsetChanged);
            ((PreviewControl)Globals.PreviewControl).FrameOffsetChanged +=
                new FrameOffsetEventHandler(((StripControl)Globals.StripControl).OnFrameOffsetChanged);

            // We always have a document around

            if (strOpenFileName == null)
                NewDocument();
            else
                OpenDocument(strOpenFileName);
        }
コード例 #3
0
        public override void PerformRestore(DockingManager dm)
        {
            int count = dm.Container.Controls.Count;

            int min = -1;
            int max = count;

            if (dm.InnerControl != null)
                min = dm.Container.Controls.IndexOf(dm.InnerControl);

            if (dm.OuterControl != null)
                max = dm.OuterControlIndex();

            int beforeIndex = -1;
            int afterIndex = max;
            int beforeAllIndex = -1;
            int afterAllIndex = max;

            // Create a collection of the Zones in the appropriate direction
            for(int index=0; index<count; index++)
            {
                Zone z = dm.Container.Controls[index] as Zone;

                if (z != null)
                {
                    StringCollection sc = ZoneHelper.ContentNames(z);

                    if (_state == z.State)
                    {
                        if (sc.Contains(_best))
                        {
                            // Can we delegate to a child Restore object
                            if (_child != null)
                                _child.PerformRestore(z);
                            else
                            {
                                // Just add an appropriate Window to start of the Zone
                                dm.AddContentToZone(_content, z, 0);
                            }
                            return;
                        }

                        // If the WindowContent contains a Content previous to the target
                        if (sc.Contains(_previous))
                        {
                            if (index > beforeIndex)
                                beforeIndex = index;
                        }

                        // If the WindowContent contains a Content next to the target
                        if (sc.Contains(_next))
                        {
                            if (index < afterIndex)
                                afterIndex = index;
                        }
                    }
                    else
                    {
                        // If the WindowContent contains a Content previous to the target
                        if (sc.Contains(_previousAll))
                        {
                            if (index > beforeAllIndex)
                                beforeAllIndex = index;
                        }

                        // If the WindowContent contains a Content next to the target
                        if (sc.Contains(_nextAll))
                        {
                            if (index < afterAllIndex)
                                afterAllIndex = index;
                        }
                    }
                }
            }

            dm.Container.SuspendLayout();

            // Create a new Zone with correct State
            Zone newZ = dm.CreateZoneForContent(_state);

            // Restore the correct content size/location values
            _content.DisplaySize = _size;
            _content.DisplayLocation = _location;

            // Add an appropriate Window to start of the Zone
            dm.AddContentToZone(_content, newZ, 0);

            // Did we find a valid 'before' Zone?
            if (beforeIndex != -1)
            {
                // Try and place more accurately according to other edge Zones
                if (beforeAllIndex > beforeIndex)
                    beforeIndex = beforeAllIndex;

                // Check against limits
                if (beforeIndex >= max)
                    beforeIndex = max - 1;

                dm.Container.Controls.SetChildIndex(newZ, beforeIndex + 1);
            }
            else
            {
                // Try and place more accurately according to other edge Zones
                if (afterAllIndex < afterIndex)
                    afterIndex = afterAllIndex;

                // Check against limits
                if (afterIndex <= min)
                    afterIndex = min + 1;

                if (afterIndex > min)
                    dm.Container.Controls.SetChildIndex(newZ, afterIndex);
                else
                {
                    // Set the Zone to be the least important of our Zones
                    dm.ReorderZoneToInnerMost(newZ);
                }
            }

            dm.Container.ResumeLayout();
        }
        /// <summary>
        /// 为设计器添加可停靠窗口
        /// </summary>
        private void AddDockingManagers()
        {
            dockManager = new DockingManager(this, VisualStyle.IDE);
            //定义对象OuterControl,Docking Manager不会关注该对象以后生成的对象的窗口区域
            //对象InnerControl,Docking Manager不会关注在该对象生成以前的对象的窗口区域
            dockManager.OuterControl = this.toolStripOperation;
            dockManager.InnerControl = this.ViewDesign;

            //添加可隐藏的控件模块库窗口
            this.tabSolution_Controls = new Content(this.dockManager);
            this.tabSolution_Controls.Control = this.toolboxServiceImpl;
            this.tabSolution_Controls.FullTitle = "控制模块库";
            this.tabSolution_Controls.Title = "控制模块库";
            this.tabSolution_Controls.AutoHideSize = this.toolboxServiceImpl.Size;
            this.tabSolution_Controls.DisplaySize = this.toolboxServiceImpl.Size;
            dockManager.Contents.Add(this.tabSolution_Controls);
            dockManager.AddContentWithState(this.tabSolution_Controls, State.DockLeft);

            //添加可隐藏的属性设计窗口
            this.tabSolution_Property = new Content(this.dockManager);
            this.tabSolution_Property.Control = this.controlfilteredPropertyGrid;
            this.tabSolution_Property.FullTitle = "模块属性";
            this.tabSolution_Property.Title = "模块属性";
            this.tabSolution_Property.AutoHideSize = this.controlfilteredPropertyGrid.Size;
            this.tabSolution_Property.DisplaySize = this.controlfilteredPropertyGrid.Size;
            this.tabSolution_Property.DisplayLocation =
                new Point(this.Location.X + this.Width - 200, this.Location.Y + 100);
            this.tabSolution_Property.FloatingSize = this.controlfilteredPropertyGrid.Size;
            dockManager.Contents.Add(this.tabSolution_Property);
            dockManager.AddContentWithState(this.tabSolution_Property, State.Floating);

            //添加可隐藏的资源管理器窗口
            this.tabSolution_TreeView = new Content(this.dockManager);
            this.tabSolution_TreeView.Control = this.solutionTreeView;
            this.tabSolution_TreeView.FullTitle = "资源管理器";
            this.tabSolution_TreeView.Title = "资源管理器";
            this.tabSolution_TreeView.AutoHideSize = this.solutionTreeView.Size;
            this.tabSolution_TreeView.DisplaySize = this.solutionTreeView.Size;

            //添加可隐藏的工程管理器窗口
            this.tabSolution_ListBox = new Content(dockManager);
            this.tabSolution_ListBox.Control = this.ProListBox;
            this.tabSolution_ListBox.FullTitle = "工程管理器";
            this.tabSolution_ListBox.Title = "工程管理器";
            this.tabSolution_ListBox.AutoHideSize = this.ProListBox.Size;
            this.tabSolution_ListBox.DisplaySize = this.ProListBox.Size;

            Zone zone = dockManager.CreateZoneForContent(State.DockRight);
            dockManager.ReorderZoneToInnerMost(zone);
            dockManager.Contents.Add(this.tabSolution_ListBox);
            dockManager.AddContentToZone(this.tabSolution_ListBox, zone, 0);
            dockManager.Contents.Add(this.tabSolution_TreeView);
            dockManager.AddContentToZone(this.tabSolution_TreeView, zone, 1);

            //添加可隐藏的错误列表窗口
            this.tabSolution_ErrorBox = new Content(this.dockManager);
            this.tabSolution_ErrorBox.Control = this.errorForm;
            this.tabSolution_ErrorBox.FullTitle = "错误列表";
            this.tabSolution_ErrorBox.Title = "错误列表";
            this.tabSolution_ErrorBox.AutoHideSize = this.errorForm.Size;
            this.tabSolution_ErrorBox.DisplaySize = this.errorForm.Size;
            this.dockManager.Contents.Add(this.tabSolution_ErrorBox);
            this.dockManager.AddContentWithState(this.tabSolution_ErrorBox, State.DockBottom);

            //为隐藏窗口添加关闭事件处理函数,当隐藏窗口关闭时设置响应窗口状态栏的状态
            this.dockManager.ContentHidden +=
                new DockingManager.ContentHandler(dockingManager_Controls_ContentHidden);
        }