Esempio n. 1
0
        private static bool TearOff(ParallelLine parallelLine)
        {
            if (parallelLine == null)
            {
                return(false);
            }

            Drawing       drawing     = parallelLine.Drawing;
            PointPair     coordinates = parallelLine.Coordinates;
            FreePoint     point1      = Factory.CreateFreePoint(drawing, coordinates.P1);
            FreePoint     point2      = Factory.CreateFreePoint(drawing, coordinates.P2);
            LineTwoPoints line        = Factory.CreateLineTwoPoints(drawing, new[] { point1, point2 });

            using (drawing.ActionManager.CreateTransaction())
            {
                Actions.Add(drawing, point1);
                Actions.Add(drawing, point2);
                Actions.Add(drawing, line);
                Actions.ReplaceWithExisting(parallelLine, line);
                Actions.Remove(parallelLine);
            }

            drawing.RaiseDisplayProperties(line);

            return(true);
        }
Esempio n. 2
0
        private static bool TearOff(ParallelLine parallelLine)
        {
            if (parallelLine == null)
            {
                return false;
            }

            Drawing drawing = parallelLine.Drawing;
            PointPair coordinates = parallelLine.Coordinates;
            FreePoint point1 = Factory.CreateFreePoint(drawing, coordinates.P1);
            FreePoint point2 = Factory.CreateFreePoint(drawing, coordinates.P2);
            LineTwoPoints line = Factory.CreateLineTwoPoints(drawing, new[] { point1, point2 });

            using (drawing.ActionManager.CreateTransaction())
            {
                Actions.Add(drawing, point1);
                Actions.Add(drawing, point2);
                Actions.Add(drawing, line);
                Actions.ReplaceWithExisting(parallelLine, line);
                Actions.Remove(parallelLine);
            }

            drawing.RaiseDisplayProperties(line);

            return true;
        }