protected void CreateDockingWindows() { // Create the docking manager instance _manager = new DockingManager(this, VisualStyle.IDE); // Define innner/outer controls for correct docking operation _manager.InnerControl = tabControl1; _manager.OuterControl = menuControl1; // Create the tree control TreeView tv = new DragTree(); tv.Nodes.Add(new TreeNode("First")); tv.Nodes.Add(new TreeNode("Second")); tv.Nodes.Add(new TreeNode("Third")); tv.Nodes.Add(new TreeNode("Fourth")); // Create a rich text box for the second content _global = new RichTextBox(); // Create content instances Content c1 = _manager.Contents.Add(tv, "TreeView"); Content c2 = _manager.Contents.Add(_global, "Another Window"); // Add to the display on the left hand side WindowContent wc = _manager.AddContentWithState(c1, State.DockLeft); // Add at the bottom of the same column _manager.AddContentToZone(c2, wc.ParentZone, 1); }
protected void OnCreateC31(object sender, EventArgs e) { // Create three Content objects, one of each type Content cA = _manager.Contents.Add(new DummyForm(), "Form " + _count++, _internalImages, _count % 6); Content cB = _manager.Contents.Add(new DummyPanel(), "Panel " + _count++, _internalImages, _count % 6); Content cC = _manager.Contents.Add(new RichTextBox(), "RichTextBox " + _count++, _internalImages, _count % 6); // Setup initial state to match menu selections DefineContentState(cA); DefineContentState(cB); DefineContentState(cC); // Setup the correct starting colors to match the menu selections DefineControlColors(cA); DefineControlColors(cB); DefineControlColors(cC); // Request a new Docking window be created for the first content on the bottom edge WindowContent wc = _manager.AddContentWithState(cA, State.DockBottom) as WindowContent; // Add two other content into the same Zone _manager.AddContentToZone(cB, wc.ParentZone, 1); _manager.AddContentToZone(cC, wc.ParentZone, 2); }
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(); }
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); } }