Esempio n. 1
0
        private void SetOutline(DockPane pane, DockStyle dock, int contentIndex)
        {
            if (dock != DockStyle.Fill)
            {
                Rectangle rect = pane.DisplayingRectangle;
                if (dock == DockStyle.Right)
                {
                    rect.X += rect.Width / 2;
                }
                if (dock == DockStyle.Bottom)
                {
                    rect.Y += rect.Height / 2;
                }
                if (dock == DockStyle.Left || dock == DockStyle.Right)
                {
                    rect.Width -= rect.Width / 2;
                }
                if (dock == DockStyle.Top || dock == DockStyle.Bottom)
                {
                    rect.Height -= rect.Height / 2;
                }
                rect.Location = pane.PointToScreen(rect.Location);

                SetDragForm(rect);
            }
            else if (contentIndex == -1)
            {
                Rectangle rect = pane.DisplayingRectangle;
                rect.Location = pane.PointToScreen(rect.Location);
                SetDragForm(rect);
            }
            else
            {
                using (GraphicsPath path = pane.TabStripControl.GetOutlinePath(contentIndex)) {
                    RectangleF rectF = path.GetBounds();
                    Rectangle  rect  = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
                    using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) })) {
                        path.Transform(matrix);
                    }
                    Region region = new Region(path);
                    SetDragForm(rect, region);
                }
            }
        }
Esempio n. 2
0
        private void Content_BeginDrag(IDockContent content)
        {
            DockPane  pane     = content.DockHandler.Pane;
            Rectangle rectPane = pane.ClientRectangle;

            Point pt;

            if (pane.DockState == DockState.Document)
            {
                pt = new Point(rectPane.Left, rectPane.Top);
            }
            else
            {
                pt = new Point(rectPane.Left, rectPane.Bottom);
            }

            pt = pane.PointToScreen(pt);

            m_mouseOffset.X = pt.X - StartMousePosition.X;
            m_mouseOffset.Y = pt.Y - StartMousePosition.Y;
        }
        /// <exclude />
        protected internal override GraphicsPath GetOutlinePath(int index)
        {
            Point[] pts = new Point[8];

            if (Appearance == DockPane.AppearanceStyle.Document)
            {
                Rectangle rectTab = GetTabRectangle(index);
                rectTab.Intersect(TabsRectangle);
                int       y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Bottom))).Y;
                Rectangle rectPaneCliente = DockPane.ClientRectangle;
                pts[0] = DockPane.PointToScreen(new Point(rectPaneCliente.Left, y));
                pts[1] = PointToScreen(new Point(rectTab.Left, rectTab.Bottom));
                pts[2] = PointToScreen(new Point(rectTab.Left, rectTab.Top));
                pts[3] = PointToScreen(new Point(rectTab.Right, rectTab.Top));
                pts[4] = PointToScreen(new Point(rectTab.Right, rectTab.Bottom));
                pts[5] = DockPane.PointToScreen(new Point(rectPaneCliente.Right, y));
                pts[6] = DockPane.PointToScreen(new Point(rectPaneCliente.Right, rectPaneCliente.Bottom));
                pts[7] = DockPane.PointToScreen(new Point(rectPaneCliente.Left, rectPaneCliente.Bottom));
            }
            else
            {
                Rectangle rectTab = GetTabRectangle(index);
                rectTab.Intersect(TabsRectangle);
                int       y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Top))).Y;
                Rectangle rectPaneCliente = DockPane.ClientRectangle;
                pts[0] = DockPane.PointToScreen(new Point(rectPaneCliente.Left, rectPaneCliente.Top));
                pts[1] = DockPane.PointToScreen(new Point(rectPaneCliente.Right, rectPaneCliente.Top));
                pts[2] = DockPane.PointToScreen(new Point(rectPaneCliente.Right, y));
                pts[3] = PointToScreen(new Point(rectTab.Right, rectTab.Top));
                pts[4] = PointToScreen(new Point(rectTab.Right, rectTab.Bottom));
                pts[5] = PointToScreen(new Point(rectTab.Left, rectTab.Bottom));
                pts[6] = PointToScreen(new Point(rectTab.Left, rectTab.Top));
                pts[7] = DockPane.PointToScreen(new Point(rectPaneCliente.Left, y));
            }

            GraphicsPath path = new GraphicsPath();

            path.AddLines(pts);
            return(path);
        }
Esempio n. 4
0
    private void SetOutline(DockPane pane, DockStyle dock, int contentIndex) {
      if (dock != DockStyle.Fill) {
        Rectangle rect = pane.DisplayingRectangle;
        if (dock == DockStyle.Right)
          rect.X += rect.Width / 2;
        if (dock == DockStyle.Bottom)
          rect.Y += rect.Height / 2;
        if (dock == DockStyle.Left || dock == DockStyle.Right)
          rect.Width -= rect.Width / 2;
        if (dock == DockStyle.Top || dock == DockStyle.Bottom)
          rect.Height -= rect.Height / 2;
        rect.Location = pane.PointToScreen(rect.Location);

        SetDragForm(rect);
      } else if (contentIndex == -1) {
        Rectangle rect = pane.DisplayingRectangle;
        rect.Location = pane.PointToScreen(rect.Location);
        SetDragForm(rect);
      } else {
        using (GraphicsPath path = pane.TabStripControl.GetOutlinePath(contentIndex)) {
          RectangleF rectF = path.GetBounds();
          Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
          using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) })) {
            path.Transform(matrix);
          }
          Region region = new Region(path);
          SetDragForm(rect, region);
        }
      }
    }
Esempio n. 5
0
        private void RefreshChanges()
        {
            Region    region       = new Region(Rectangle.Empty);
            Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;

            rectDockArea.Location = DockPanel.PointToScreen(rectDockArea.Location);
            if (ShouldPanelIndicatorVisible(DockState.DockLeft))
            {
                PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelLeft.Visible  = true;
                region.Union(PanelLeft.Bounds);
            }
            else
            {
                PanelLeft.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockRight))
            {
                PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelRight.Visible  = true;
                region.Union(PanelRight.Bounds);
            }
            else
            {
                PanelRight.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockTop))
            {
                PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
                PanelTop.Visible  = true;
                region.Union(PanelTop.Bounds);
            }
            else
            {
                PanelTop.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockBottom))
            {
                PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
                PanelBottom.Visible  = true;
                region.Union(PanelBottom.Bounds);
            }
            else
            {
                PanelBottom.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.Document))
            {
                Rectangle rectDocumentWindow = DockPanel.DocumentWindowBounds;
                rectDocumentWindow.Location = DockPanel.PointToScreen(rectDocumentWindow.Location);
                PanelFill.Location          = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
                PanelFill.Visible           = true;
                region.Union(PanelFill.Bounds);
            }
            else
            {
                PanelFill.Visible = false;
            }

            if (ShouldPaneDiamondVisible())
            {
                Rectangle rect = DockPane.ClientRectangle;
                rect.Location        = DockPane.PointToScreen(rect.Location);
                PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
                PaneDiamond.Visible  = true;
                using (GraphicsPath graphicsPath = PaneDiamond.DisplayingGraphicsPath.Clone() as GraphicsPath) {
                    Point[] pts = new Point[]
                    {
                        new Point(PaneDiamond.Left, PaneDiamond.Top),
                        new Point(PaneDiamond.Right, PaneDiamond.Top),
                        new Point(PaneDiamond.Left, PaneDiamond.Bottom)
                    };
                    using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts)) {
                        graphicsPath.Transform(matrix);
                    }
                    region.Union(graphicsPath);
                }
            }
            else
            {
                PaneDiamond.Visible = false;
            }

            Region = region;
        }