Zooming Out and Zooming In (Visual Basic Script)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD Raster View control:

1.

Start with the project that you created in Loading and Displaying an Image.

2.

Add the following code between the <FORM> </FORM> tags to create two buttons: "btnZoomIn" and "btnZoomOut":

<INPUT TYPE="button" NAME="btnZoomIn" VALUE="Zoom In" LANGUAGE="VBScript"
   OnClick="ZoomIn">
         
<INPUT TYPE="button" NAME="btnZoomOut" VALUE="Zoom Out" LANGUAGE="VBScript"
   OnClick="ZoomOut">

3.

Add the following subroutines between the <SCRIPT> </SCRIPT> tags for the btnZoonIn and btnZoomOut buttons respectively:

Sub ZoomIn()
Dim PAINTSIZEMODE_ZOOM
PAINTSIZEMODE_ZOOM = 4

LEADRasterView1.AutoSetRects = True  
LEADRasterView1.PaintSizeMode = PAINTSIZEMODE_ZOOM
LEADRasterView1.PaintZoomFactor = LEADRasterView1.PaintZoomFactor + 10
LEADRasterView1.ForceRepaint
End Sub

Sub ZoomOut()
      Dim PAINTSIZEMODE_ZOOM
PAINTSIZEMODE_ZOOM = 4

LEADRasterView1.AutoSetRects = True
LEADRasterView1.PaintSizeMode = PAINTSIZEMODE_ZOOM
If LEADRasterView1.PaintZoomFactor > 10 Then
LEADRasterView1.PaintZoomFactor = LEADRasterView1.PaintZoomFactor - 10
End If
End Sub

4.

Run the page to test it.