private void CreateDocumentDockArea(object sender, EventArgs e) { if (this.m_DockPanelManager.DocumentArea != null) { return; } // IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost; if (host == null) { return; } DocumentDockArea documentAreaPanel = host.CreateComponent(typeof(DocumentDockArea)) as DocumentDockArea; if (documentAreaPanel == null) { return; } documentAreaPanel.Dock = DockStyle.Fill; documentAreaPanel.Text = documentAreaPanel.Name; this.m_DockPanelManager.DocumentArea = documentAreaPanel; this.m_DockPanelManager.ParentForm.Controls.Add(documentAreaPanel); if (this.m_DockPanelManager.ParentForm.Controls.Count > 1) { this.m_DockPanelManager.ParentForm.Controls.SetChildIndex(documentAreaPanel, 0); } }
public override void Initialize(IComponent component) { base.Initialize(component); this.m_DocumentDockArea = base.Component as DocumentDockArea; }
private void CreateDocumentDockPanel(object sender, EventArgs e) { IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost; // if (host == null) { return; } // if (this.m_DockPanelManager.DocumentArea == null) { DocumentDockArea documentAreaPanel = host.CreateComponent(typeof(DocumentDockArea)) as DocumentDockArea; if (documentAreaPanel == null) { return; } documentAreaPanel.Dock = DockStyle.Fill; documentAreaPanel.Text = documentAreaPanel.Name; this.m_DockPanelManager.DocumentArea = documentAreaPanel; this.m_DockPanelManager.ParentForm.Controls.Add(documentAreaPanel); if (this.m_DockPanelManager.ParentForm.Controls.Count > 1) { this.m_DockPanelManager.ParentForm.Controls.SetChildIndex(documentAreaPanel, 0); } // BasePanel basePanel = host.CreateComponent(typeof(BasePanel)) as BasePanel; DockPanel dockPanel = host.CreateComponent(typeof(DockPanel)) as DockPanel; if (basePanel == null || dockPanel == null) { return; } basePanel.Dock = DockStyle.Fill; basePanel.Text = basePanel.Name; dockPanel.BasePanels.Add(basePanel); dockPanel.Dock = DockStyle.Fill; this.m_DockPanelManager.DocumentArea.Controls.Add(dockPanel); this.m_DockPanelManager.BasePanels.Add(basePanel); this.m_DockPanelManager.DockPanels.Add(dockPanel); } else if (this.m_DockPanelManager.DocumentArea is DocumentDockArea) { DockPanel dockPanel = ((DocumentDockArea)this.m_DockPanelManager.DocumentArea).GetDockPanel(); if (dockPanel != null) { BasePanel basePanel = host.CreateComponent(typeof(BasePanel)) as BasePanel; if (basePanel == null) { return; } basePanel.Dock = DockStyle.Fill; basePanel.Text = basePanel.Name; dockPanel.BasePanels.Add(basePanel); this.m_DockPanelManager.BasePanels.Add(basePanel); } else { BasePanel basePanel = host.CreateComponent(typeof(BasePanel)) as BasePanel; dockPanel = host.CreateComponent(typeof(DockPanel)) as DockPanel; if (basePanel == null || dockPanel == null) { return; } basePanel.Dock = DockStyle.Fill; basePanel.Text = basePanel.Name; dockPanel.BasePanels.Add(basePanel); dockPanel.Dock = DockStyle.Fill; this.m_DockPanelManager.DocumentArea.Controls.Add(dockPanel); this.m_DockPanelManager.BasePanels.Add(basePanel); this.m_DockPanelManager.DockPanels.Add(dockPanel); } } }