Exemple #1
0
        private Point GetCp4(Rect rect, Point p1, Point p2)
        {
            var rightLineEquation = new LineEquation(p1, p2);
            var dock = Dock;

            var isBottom = (dock & TabItemDock.Bottom) == TabItemDock.Bottom;
            if (isBottom)
            {
                return rightLineEquation.IntersectWithHorizontalLine(p2.X, rect.Bottom);
            }

            var isTop = (dock & TabItemDock.Top) == TabItemDock.Top;
            if (isTop)
            {
                return rightLineEquation.IntersectWithHorizontalLine(p2.X, rect.Top);
            }

            var isLeft = (dock & TabItemDock.Left) == TabItemDock.Left;
            if (isLeft)
            {
                return rightLineEquation.IntersectWithVerticalLine(p2.Y, rect.Left);
            }

            return rightLineEquation.IntersectWithVerticalLine(p2.Y, rect.Right);
        }
Exemple #2
0
        private Point GetCp2(Rect rect, Point p1, Point p2)
        {
            var leftLineEquation = new LineEquation(p1, p2);
            var dock = Dock;

            var isBottom = (dock & TabItemDock.Bottom) == TabItemDock.Bottom;
            if (isBottom)
            {
                // the 1st control point is the intersection between the slope line and the base line.
                return leftLineEquation.IntersectWithHorizontalLine(p2.X, rect.Top);
            }

            var isTop = (dock & TabItemDock.Top) == TabItemDock.Top;
            if (isTop)
            {
                return leftLineEquation.IntersectWithHorizontalLine(p2.X, rect.Bottom);
            }

            var isLeft = (dock & TabItemDock.Left) == TabItemDock.Left;
            if (isLeft)
            {
                return leftLineEquation.IntersectWithVerticalLine(p2.Y, rect.Right);
            }

            return leftLineEquation.IntersectWithVerticalLine(p2.Y, rect.Left);
        }