Example #1
0
        public void UngroupShapes(GroupBox el, bool dispose = true)
        {
            List <GraphicElement> intersections = FindAllIntersections(el).ToList();

            // Preserve the original list, including the group boxes, for when we update the screen,
            // So that the erased groupbox region is updated on the screen.
            List <GraphicElement> originalIntersections = new List <GraphicElement>(intersections);

            el.GroupChildren.ForEach(c => c.Parent = null);
            el.GroupChildren.Clear();
            EraseTopToBottom(intersections.AsEnumerable());

            elements.Remove(el);
            intersections.Remove(el);

            DrawBottomToTop(intersections.AsEnumerable());
            UpdateScreen(originalIntersections);        // remember, this updates the screen for the now erased groupbox.

            if (dispose)
            {
                el.Dispose();
            }
        }