Ejemplo n.º 1
0
        public void DockTo(DockPanel panel, DockStyle dockStyle)
        {
            if (panel != this.DockPanel)
            {
                throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
            }
            NestedPaneCollection nestedPaneCollection = null;

            if (dockStyle == DockStyle.Top)
            {
                nestedPaneCollection = this.DockPanel.DockWindows[DockState.DockTop].NestedPanes;
            }
            else
            {
                if (dockStyle == DockStyle.Bottom)
                {
                    nestedPaneCollection = this.DockPanel.DockWindows[DockState.DockBottom].NestedPanes;
                }
                else
                {
                    if (dockStyle == DockStyle.Left)
                    {
                        nestedPaneCollection = this.DockPanel.DockWindows[DockState.DockLeft].NestedPanes;
                    }
                    else
                    {
                        if (dockStyle == DockStyle.Right)
                        {
                            nestedPaneCollection = this.DockPanel.DockWindows[DockState.DockRight].NestedPanes;
                        }
                        else
                        {
                            if (dockStyle == DockStyle.Fill)
                            {
                                nestedPaneCollection = this.DockPanel.DockWindows[DockState.Document].NestedPanes;
                            }
                        }
                    }
                }
            }
            DockPane prevPane = null;

            checked
            {
                for (int i = nestedPaneCollection.Count - 1; i >= 0; i--)
                {
                    if (nestedPaneCollection[i] != this.VisibleNestedPanes[0])
                    {
                        prevPane = nestedPaneCollection[i];
                    }
                }
                FloatWindow.MergeNestedPanes(this.VisibleNestedPanes, nestedPaneCollection, prevPane, DockAlignment.Left, 0.5);
            }
        }
Ejemplo n.º 2
0
 public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
 {
     checked
     {
         if (dockStyle == DockStyle.Fill)
         {
             for (int i = this.NestedPanes.Count - 1; i >= 0; i--)
             {
                 DockPane dockPane = this.NestedPanes[i];
                 for (int j = dockPane.Contents.Count - 1; j >= 0; j--)
                 {
                     IDockContent dockContent = dockPane.Contents[j];
                     dockContent.DockHandler.Pane = pane;
                     if (contentIndex != -1)
                     {
                         pane.SetContentIndex(dockContent, contentIndex);
                     }
                     dockContent.DockHandler.Activate();
                 }
             }
         }
         else
         {
             DockAlignment alignment = DockAlignment.Left;
             if (dockStyle == DockStyle.Left)
             {
                 alignment = DockAlignment.Left;
             }
             else
             {
                 if (dockStyle == DockStyle.Right)
                 {
                     alignment = DockAlignment.Right;
                 }
                 else
                 {
                     if (dockStyle == DockStyle.Top)
                     {
                         alignment = DockAlignment.Top;
                     }
                     else
                     {
                         if (dockStyle == DockStyle.Bottom)
                         {
                             alignment = DockAlignment.Bottom;
                         }
                     }
                 }
             }
             FloatWindow.MergeNestedPanes(this.VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
         }
     }
 }