Example #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.GetOutline(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);
                        }
                    }
                }
Example #2
0
        protected internal override GraphicsPath GetOutline(int index)
        {
            Point[] pts = new Point[8];
            if (Appearance == BaseControls.Docking.DockPane.AppearanceStyle.Document)
            {
                Rectangle rectTab = GetTabRectangle(index);
                rectTab.Intersect(TabsRectangle);
                int       y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Bottom))).Y;
                Rectangle rectPaneClient = DockPane.ClientRectangle;
                pts[0] = DockPane.PointToScreen(new Point(rectPaneClient.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 + _DocumentTabOverlap, rectTab.Top));
                pts[4] = PointToScreen(new Point(rectTab.Right + _DocumentTabOverlap, rectTab.Bottom));
                pts[5] = DockPane.PointToScreen(new Point(rectPaneClient.Right, y));
                pts[6] = DockPane.PointToScreen(new Point(rectPaneClient.Right, rectPaneClient.Bottom));
                pts[7] = DockPane.PointToScreen(new Point(rectPaneClient.Left, rectPaneClient.Bottom));
            }
            else
            {
                Rectangle rectTab = GetTabRectangle(index);
                rectTab.Intersect(TabsRectangle);
                int       y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Top))).Y + 1;
                Rectangle rectPaneClient = DockPane.ClientRectangle;
                pts[0] = DockPane.PointToScreen(new Point(rectPaneClient.Left, rectPaneClient.Top));
                pts[1] = DockPane.PointToScreen(new Point(rectPaneClient.Right, rectPaneClient.Top));
                pts[2] = DockPane.PointToScreen(new Point(rectPaneClient.Right, y));
                pts[3] = PointToScreen(new Point(rectTab.Right + 1, rectTab.Top));
                pts[4] = PointToScreen(new Point(rectTab.Right + 1, rectTab.Bottom));
                pts[5] = PointToScreen(new Point(rectTab.Left + 1, rectTab.Bottom));
                pts[6] = PointToScreen(new Point(rectTab.Left + 1, rectTab.Top));
                pts[7] = DockPane.PointToScreen(new Point(rectPaneClient.Left, y));
            }
            GraphicsPath path = new GraphicsPath();

            path.AddLines(pts);
            return(path);
        }