Ejemplo n.º 1
0
        private void ungroupToParentGroupButton_Click(object sender, System.EventArgs e)
        {
            // get the group and its parent group
            NGroup group = (view.Selection.AnchorNode as NGroup);

            if (group == null)
            {
                return;
            }

            NGroup parentGroup = group.Group;

            if (parentGroup == null)
            {
                return;
            }

            // create a new batch ungroup and check whether it can be executed
            NBatchUngroup batchUngroup = new NBatchUngroup(document, view.Selection.Nodes);

            if (batchUngroup.CanUngroup(parentGroup, false) == false)
            {
                return;
            }

            // ungroup the selected groups to the active layer
            NNodeList          shapes;
            NTransactionResult res = batchUngroup.Ungroup(parentGroup, false, out shapes);

            // single select the parent group if the ungroup was successful
            if (res.Succeeded)
            {
                view.Selection.SingleSelect(parentGroup);
            }

            // ask the view to display any information about the transaction status (if it was not completed)
            view.ProcessTransactionResult(res);
        }
Ejemplo n.º 2
0
        private void ungroupToLayerButton_Click(object sender, System.EventArgs e)
        {
            // create a new batch ungroup and check whether it can be executed
            NBatchUngroup batchUngroup = new NBatchUngroup(document, view.Selection.Nodes);

            if (batchUngroup.CanUngroup(document.ActiveLayer, false) == false)
            {
                return;
            }

            // ungroup the selected groups to the active layer
            NNodeList          shapes;
            NTransactionResult res = batchUngroup.Ungroup(document.ActiveLayer, false, out shapes);

            // single select the ungrouped shapes if the ungroup was successful
            if (res.Succeeded)
            {
                view.Selection.SingleSelect(shapes);
            }

            // ask the view to display any information about the transaction status (if it was not completed)
            view.ProcessTransactionResult(res);
        }