Viewer.OnViewChanged event (Visio Viewer)

Occurs when the view of the current page is changed in Microsoft Visio Viewer.

Syntax

expression.OnViewChanged (PageXAtViewCenter, PageYAtViewCenter, ZoomFactor)

expression An expression that returns a Viewer object.

Parameters

Name Required/Optional Data type Description
PageXAtViewCenter Required Double The x-coordinate, in drawing units, of the center of the page.
PageYAtViewCenter Required Double The y-coordinate, in drawing units, of the center of the page.
ZoomFactor Required Double The factor by which the zoom (the page size) is multiplied.

Return value

Nothing

Remarks

The page view consists of the center point of the page, expressed in x-y page coordinates, with the origin of the coordinate system at the lower-left corner of the page, and the zoom factor, expressed as a numerical percentage, ranging from 1% to 400%.

You can get the current page view in Visio Viewer by using the GetPageView method, and you can set the page view programmatically by using the SetPageView method.

Example

The following code shows how to use the OnViewChanged event to display the new page-view data in the Immediate window.

Private Sub vsoViewer_OnViewChanged(ByVal PageXAtViewCenter As Double, ByVal PageYAtViewCenter As Double, ByVal ZoomFactor As Double)

    Dim dblXPoint As Double

    Dim dblYPoint As Double

    Dim dblZoomFactor As Double

    vsoViewer.GetPageView dblXPoint, dblYPoint, dblZoomFactor

    Debug.Print "New x-coordinate is:"; dblXPoint

    Debug.Print "New y-coordinate is:"; dblYPoint

    Debug.Print "New zoom factor is:"; dblZoomFactor

End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.