Ejemplo n.º 1
0
        protected override Region GetTestDropDragFrame(DockStyle dock, int contentIndex)
        {
            int dragSize = MeasureContentWindow.DragSize;

            if (dock != DockStyle.Fill)
            {
                Rectangle rect = TabWindowRectangle;
                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 = PointToScreen(rect.Location);

                return(DrawHelper.CreateDragFrame(rect, dragSize));
            }
            else
            {
                Rectangle[] rects = new Rectangle[3];
                rects[2] = Rectangle.Empty;
                rects[0] = TabWindowRectangle;
                if (contentIndex != -1)
                {
                    rects[1] = GetTabRectangle(contentIndex);
                }
                else
                {
                    rects[1] = Rectangle.Empty;
                }

                if (!rects[1].IsEmpty)
                {
                    rects[0].Height = rects[1].Top - rects[0].Top;
                    rects[2].X      = rects[1].X + dragSize;
                    rects[2].Y      = rects[1].Y - dragSize;
                    rects[2].Width  = rects[1].Width - 2 * dragSize;
                    rects[2].Height = 2 * dragSize;
                }

                rects[0].Location = PointToScreen(rects[0].Location);
                rects[1].Location = PointToScreen(rects[1].Location);
                rects[2].Location = PointToScreen(rects[2].Location);
                return(DrawHelper.CreateDragFrame(rects, dragSize));
            }
        }
Ejemplo n.º 2
0
        private void TabWindowSplitter_BeginDrag(Point ptSplitter)
        {
            m_splitterLocation = ptSplitter;
            m_splitterLocation = DragControl.PointToScreen(m_splitterLocation);
            Point ptMouse = StartMousePosition;

            m_mouseOffset.X = m_splitterLocation.X - ptMouse.X;
            m_mouseOffset.Y = m_splitterLocation.Y - ptMouse.Y;

            Rectangle rect = TabWindowSplitter_GetDragRectangle();

            DragFrame = DrawHelper.CreateDragFrame(rect, DragBorderWidth);
        }
Ejemplo n.º 3
0
        protected override Region GetTestDropDragFrame(DockStyle dock, int contentIndex)
        {
            int dragSize = MeasureContentWindow.DragSize;

            Rectangle[] rects = new Rectangle[3];

            rects[0] = TabWindowRectangle;
            if (dock == DockStyle.Right)
            {
                rects[0].X += rects[0].Width / 2;
            }
            else if (dock == DockStyle.Bottom)
            {
                rects[0].Y += rects[0].Height / 2;
            }
            if (dock == DockStyle.Left || dock == DockStyle.Right)
            {
                rects[0].Width -= rects[0].Width / 2;
            }
            else if (dock == DockStyle.Top || dock == DockStyle.Bottom)
            {
                rects[0].Height -= rects[0].Height / 2;
            }

            if (dock != DockStyle.Fill)
            {
                rects[1] = new Rectangle(rects[0].X + MeasureDocListTab.TabGapLeft, rects[0].Y,
                                         rects[0].Width - 2 * MeasureDocListTab.TabGapLeft, GetTabStripRectangle().Height);
            }
            else if (contentIndex != -1)
            {
                rects[1] = GetTabRectangle(contentIndex);
            }
            else
            {
                rects[1] = GetTabRectangle(0);
            }

            rects[0].Y       = rects[1].Top + rects[1].Height;
            rects[0].Height -= rects[1].Height;
            rects[2]         = new Rectangle(rects[1].X + dragSize, rects[0].Y - dragSize,
                                             rects[1].Width - 2 * dragSize, 2 * dragSize);

            rects[0].Location = PointToScreen(rects[0].Location);
            rects[1].Location = PointToScreen(rects[1].Location);
            rects[2].Location = PointToScreen(rects[2].Location);
            return(DrawHelper.CreateDragFrame(rects, dragSize));
        }
Ejemplo n.º 4
0
        private void FloatWindow_OnDragging()
        {
            Point ptMouse = Control.MousePosition;

            if (!TestDrop(ptMouse))
            {
                return;
            }

            if (DropTarget.DropTo == null)
            {
                Rectangle rect = DragControl.Bounds;
                rect.X    = ptMouse.X + m_mouseOffset.X;
                rect.Y    = ptMouse.Y + m_mouseOffset.Y;
                DragFrame = DrawHelper.CreateDragFrame(rect, DragBorderWidth);
            }
        }
Ejemplo n.º 5
0
        private void ContentWindow_OnDragging()
        {
            Point         ptMouse = Control.MousePosition;
            ContentWindow cw      = ((TabWindow)DragControl).ContentWindow;

            if (!TestDrop(ptMouse))
            {
                return;
            }

            if (DropTarget.DropTo == null && IsDockStateValid(DockState.Float))
            {
                Point location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y);
                Size  size;
                if (cw.FloatWindow == null)
                {
                    size = FloatWindow.DefaultWindowSize;
                }
                else if (cw.FloatWindow.ContentWindows.Count == 1)
                {
                    size = ((TabWindow)DragControl).ContentWindow.FloatWindow.Size;
                }
                else
                {
                    size = FloatWindow.DefaultWindowSize;
                }

                if (ptMouse.X > location.X + size.Width)
                {
                    location.X += ptMouse.X - (location.X + size.Width) + DragBorderWidth;
                }

                DragFrame = DrawHelper.CreateDragFrame(new Rectangle(location, size), DragBorderWidth);
            }

            if (DragFrame == null)
            {
                User32.SetCursor(Cursors.No.Handle);
            }
            else
            {
                User32.SetCursor(DragControl.Cursor.Handle);
            }
        }
Ejemplo n.º 6
0
        private void TabWindowSplitter_OnDragging()
        {
            Rectangle rect = TabWindowSplitter_GetDragRectangle();

            DragFrame = DrawHelper.CreateDragFrame(rect, DragBorderWidth);
        }