public void SetActiveWindowZoomToObject(Models.ZoomToObject zoom) { var cmdtarget = this._client.GetCommandTargetDocument(); var active_window = cmdtarget.Application.ActiveWindow; if (zoom == Models.ZoomToObject.Page) { active_window.ViewFit = (short)IVisio.VisWindowFit.visFitPage; } else if (zoom == Models.ZoomToObject.PageWidth) { active_window.ViewFit = (short)IVisio.VisWindowFit.visFitWidth; } else if (zoom == Models.ZoomToObject.Selection) { var window = cmdtarget.Application.ActiveWindow; var selection = window.Selection; if (selection.Count < 1) { return; } double padding_scale = 0.1; ViewCommands.SetViewRectToSelection(active_window, IVisio.VisBoundingBoxArgs.visBBoxExtents, padding_scale); } else { throw new System.ArgumentOutOfRangeException(nameof(zoom)); } }
public Client(IVisio.Application app, ClientContext client_context) { if (client_context == null) { throw new System.ArgumentNullException(nameof(client_context)); } this._client_context = client_context; this.Application = new Commands.ApplicationCommands(this, app); this.Arrange = new Commands.ArrangeCommands(this); this.Model = new Commands.ModelCommands(this); this.Connection = new Commands.ConnectionCommands(this); this.ConnectionPoint = new Commands.ConnectionPointCommands(this); this.Container = new Commands.ContainerCommands(this); this.Control = new Commands.ControlCommands(this); this.CustomProperty = new Commands.CustomPropertyCommands(this); this.Developer = new Commands.DeveloperCommands(this); this.Document = new Commands.DocumentCommands(this); this.Draw = new Commands.DrawCommands(this); this.Export = new Commands.ExportCommands(this); this.Grouping = new Commands.GroupingCommands(this); this.Hyperlink = new Commands.HyperlinkCommands(this); this.Layer = new Commands.LayerCommands(this); this.Lock = new Commands.LockCommands(this); this.Master = new Commands.MasterCommands(this); this.Output = new Commands.OutputCommands(this); this.Page = new Commands.PageCommands(this); this.Selection = new Commands.SelectionCommands(this); this.ShapeSheet = new Commands.ShapeSheetCommands(this); this.Text = new Commands.TextCommands(this); this.Undo = new Commands.UndoCommands(this); this.UserDefinedCell = new Commands.UserDefinedCellCommands(this); this.View = new Commands.ViewCommands(this); }
public void SetZoomToObject(VisioScripting.TargetWindow targetwindow, Models.ZoomToObject zoom) { targetwindow = targetwindow.ResolveToWindow(this._client); if (zoom == Models.ZoomToObject.Page) { targetwindow.Window.ViewFit = (short)IVisio.VisWindowFit.visFitPage; } else if (zoom == Models.ZoomToObject.PageWidth) { targetwindow.Window.ViewFit = (short)IVisio.VisWindowFit.visFitWidth; } else if (zoom == Models.ZoomToObject.Selection) { var selection = targetwindow.Window.Selection; if (selection.Count < 1) { return; } double padding_scale = 0.1; ViewCommands.SetViewRectToSelection(targetwindow.Window, IVisio.VisBoundingBoxArgs.visBBoxExtents, padding_scale); } else { throw new System.ArgumentOutOfRangeException(nameof(zoom)); } }
public void Zoom(VisioScripting.Models.Zoom zoom) { this._client.Application.AssertApplicationAvailable(); var active_window = this.GetActiveWindow(); if (zoom == Models.Zoom.Out) { var cur = active_window.Zoom; this.ZoomToPercentage(cur / this.ZoomIncrement); } else if (zoom == Models.Zoom.In) { var cur = active_window.Zoom; this.ZoomToPercentage(cur * this.ZoomIncrement); } else if (zoom == Models.Zoom.ToPage) { active_window.ViewFit = (short)IVisio.VisWindowFit.visFitPage; } else if (zoom == Models.Zoom.ToWidth) { active_window.ViewFit = (short)IVisio.VisWindowFit.visFitWidth; } else if (zoom == Models.Zoom.ToSelection) { if (!this._client.Selection.HasShapes()) { return; } double padding_scale = 0.1; ViewCommands.SetViewRectToSelection(active_window, IVisio.VisBoundingBoxArgs.visBBoxExtents, padding_scale); } else { throw new System.ArgumentOutOfRangeException(nameof(zoom)); } }