Enables a user to zoom in on a point of the MultiScaleImage.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Sub ZoomAboutLogicalPoint ( _ zoomIncrementFactor As Double, _ zoomCenterLogicalX As Double, _ zoomCenterLogicalY As Double _ )
- Type: System.Double
Specifies the zoom. This number is greater than 0. A value of 1 specifies that the image fit the allotted page size exactly. A number greater than 1 specifies to zoom in. If a value of 0 or less is used, failure is returned and no zoom changes are applied.
- Type: System.Double
X coordinate for the point on the MultiScaleImage that is zoomed in on. This is a logical point (between 0 and 1).
This method enables zooming and panning on the MultiScaleImage. The first parameter (zoomIncrementFactor) is the zoom multiplier which is incremented from the current zoom factor of the image. For example, a value of 1 specifies the default zoom and a value of 3 specifies that it is zoomed in 3 times. If you want to zoom again using the same value, you would zoom in at 3 * 3 which is 9 times from the default size.
The second and third parameters of the method are the respective x and y coordinates of the logical point of where to zoom around (and where to pan to). A logical point uses normalized values (between 0 and 1) for x and y positions within the image. Therefore, the value 0.5, 0.5 is in the middle of the image because 0.5 is in the middle of 0 and 1. If you specified a coordinate value less than or equal to 0 or greater than or equal to 1, the image would pan completely out of view.
The following example shows how to use the method to zoom in on the center of an image when the mouse pointer moves over the image, and then return back when the mouse pointer leaves the image.
Private Sub MyMSI_ImageOpenSucceeded(ByVal sender As Object, ByVal e As RoutedEventArgs) ' Turn the animations off when the image first loads. This avoids ' the default behavior of the image initially zooming into view. ' However, you will probably want to turn the animations on later ' so that the user will have animations when they pan and zoom. MyMSI.UseSprings = False End Sub Private Sub MyMSI_MouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs) If MyMSI.UseSprings = False Then MyMSI.UseSprings = True End If ' The ZoomAboutLogicalPoint method allows you to zoom and pan ' in the same step. The first parameter is the zoom (3x) and the ' second and third parameters are the respective x and y coordinates ' of the logical point to zoom around. Me.MyMSI.ZoomAboutLogicalPoint(3, 0.5, 0.5) End Sub Private Sub MyMSI_MouseLeave(ByVal sender As Object, ByVal e As MouseEventArgs) Dim zoom As Double = 1 zoom = zoom / 3 ' This time the zoom is reversed (1/3) although the pan ' remains the same - zoom back out from the middle. Me.MyMSI.ZoomAboutLogicalPoint(zoom, 0.5, 0.5) End Sub
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.