Zooming Out and Zooming In (Access 2.0)

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 control.

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

2. image\btncmd.gif Add two command buttons to your form and name them as follows:

Name

Caption

ZoomIn

Zoom In

ZoomOut

Zoom Out

3. image\btncode.gif Click the Code Window icon on the toolbar.

4. Code the ZoomIn button's click procedure as follows:

Sub ZoomIn_Click()
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.PaintSizeMode = PAINTSIZEMODE_ZOOM
  Me![Lead1].Object.PaintZoomFactor = Me![Lead1].Object.PaintZoomFactor + 10
End Sub

5. Code the ZoomOut button's click procedure as follows:

Sub ZoomOut_Click()
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.PaintSizeMode = PAINTSIZEMODE_ZOOM
  If Me![Lead1].Object.PaintZoomFactor > 10 Then
      Me![Lead1].Object.PaintZoomFactor = Me![Lead1].Object.PaintZoomFactor - 10
  End If
End Sub

6. Close the code window.

7. Click the Form View icon on the toolbar to test the form.