private static void SetViewRectToSelection(IVisio.Window window, IVisio.VisBoundingBoxArgs bbargs, double padding_scale) { if (padding_scale < 0.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } if (padding_scale > 1.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } var app = window.Application; var active_window = app.ActiveWindow; var sel = active_window.Selection; var sel_bb = sel.GetBoundingBox(bbargs); var delta = sel_bb.Size * padding_scale; var view_rect = new Drawing.Rectangle(sel_bb.Left - delta.Width, sel_bb.Bottom - delta.Height, sel_bb.Right + delta.Height, sel_bb.Top + delta.Height); window.SetViewRect(view_rect); }
public static void SetViewRect( this IVisio.Window window, VA.Drawing.Rectangle rect) { // MSDN: http://msdn.microsoft.com/en-us/library/office/ms367542(v=office.14).aspx window.SetViewRect(rect.Left, rect.Top, rect.Width, rect.Height); }