Exemplo n.º 1
0
        public void DistributeOnAxis(VisioScripting.TargetSelection targetselection, Models.Axis axis)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            if (targetselection.Selection.Count < 2)
            {
                return;
            }

            IVisio.VisUICmds cmd;

            switch (axis)
            {
            case VisioScripting.Models.Axis.XAxis:
                cmd = IVisio.VisUICmds.visCmdDistributeHSpace;
                break;

            case VisioScripting.Models.Axis.YAxis:
                cmd = IVisio.VisUICmds.visCmdDistributeVSpace;
                break;

            default:
                throw new System.ArgumentOutOfRangeException();
            }

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(DistributeOnAxis)))
            {
                targetselection.Selection.Application.DoCmd((short)cmd);
            }
        }
Exemplo n.º 2
0
        public void Duplicate(VisioScripting.TargetSelection targetselection, int n)
        {
            if (n < 1)
            {
                throw new System.ArgumentOutOfRangeException(nameof(n));
            }

            targetselection = targetselection.ResolveToSelection(this._client);

            // TODO: Add ability to duplicate all the selected shapes, not just the first one
            // this dupicates exactly 1 shape N - times what it
            // it should do is duplicate all M selected shapes N times so that M*N shapes are created

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(Duplicate)))
            {
                var app         = targetselection.Selection.Application;
                var active_page = app.ActivePage;
                var new_shapes  = DrawCommands._create_duplicates(active_page, targetselection.Selection[1], n);
            }
        }