Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
        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));
            }
        }