} public void ScrollViewToShape(IVisio.Shape shape, bool otherDocument = false) { double fensterLeft, fensterTop, fensterWidth, fensterHeigth; double pinX = xshape.ReadValue(shape, "PinX"); double pinY = xshape.ReadValue(shape, "PinY"); double zoomBefore = window.Zoom; window.Zoom = 1.1; window.GetViewRect(out fensterLeft, out fensterTop, out fensterWidth, out fensterHeigth); // if (!((0 < pinX - fensterLeft) && (pinX - fensterLeft < fensterWidth)) || !((0 < fensterTop - pinY) && (fensterTop - pinY < fensterHeigth))) window.ScrollViewTo(pinX, pinY); if (otherDocument) System.Windows.Forms.Application.DoEvents(); window.Zoom = zoomBefore; } private IEnumerable<ListItemNameResult> FindShapes(int searchOptions, IEnumerable<Shape> shapes, List<string> searchTexts, bool and = false)
public static VA.Drawing.Rectangle GetViewRect(this IVisio.Window window) { // MSDN: http://msdn.microsoft.com/en-us/library/office/ff765846.aspx double left, top, height, width; window.GetViewRect(out left, out top, out width, out height); double x0 = left; double x1 = left + width; double y0 = top - height; double y1 = y0 + height; var r = new VA.Drawing.Rectangle(x0, y0, x1, y1); return(r); }