public void DistributeVertical(Models.TargetShapes targets, Models.AlignmentVertical valign) { var cmdtarget = this._client.GetCommandTargetDocument(); int shape_count = targets.SelectShapesAndCount(this._client); if (shape_count < 1) { return; } IVisio.VisUICmds cmd; switch (valign) { case VisioScripting.Models.AlignmentVertical.Top: cmd = IVisio.VisUICmds.visCmdDistributeTop; break; case VisioScripting.Models.AlignmentVertical.Center: cmd = IVisio.VisUICmds.visCmdDistributeMiddle; break; case VisioScripting.Models.AlignmentVertical.Bottom: cmd = IVisio.VisUICmds.visCmdDistributeBottom; break; default: throw new System.ArgumentOutOfRangeException(); } cmdtarget.Application.DoCmd((short)cmd); }
public void DistributeShapesHorizontal(Models.TargetShapes targets, Models.AlignmentHorizontal halign) { var cmdtarget = this._client.GetCommandTargetDocument(); int shape_count = targets.SelectShapesAndCount(this._client); if (shape_count < 1) { return; } IVisio.VisUICmds cmd; switch (halign) { case VisioScripting.Models.AlignmentHorizontal.Left: cmd = IVisio.VisUICmds.visCmdDistributeLeft; break; case VisioScripting.Models.AlignmentHorizontal.Center: cmd = IVisio.VisUICmds.visCmdDistributeCenter; break; case VisioScripting.Models.AlignmentHorizontal.Right: cmd = IVisio.VisUICmds.visCmdDistributeRight; break; default: throw new System.ArgumentOutOfRangeException(); } cmdtarget.Application.DoCmd((short)cmd); }
public void DuplicateSelectedShapes(Models.TargetShapes target_shapes) { var cmdtarget = this._client.GetCommandTargetDocument(); int n = target_shapes.SelectShapesAndCount(this._client); this._client.Output.WriteVerbose("Number of shapes to duplicate: {0}", n); if (n < 1) { this._client.Output.WriteVerbose("Zero shapes to duplicate. No duplication operation performed"); return; } var active_window = cmdtarget.Application.ActiveWindow; var selection = active_window.Selection; selection.Duplicate(); }