Zooming Out and Zooming In (Visual Basic)
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 RasterView control.
1. |
Start with the project that you created in Loading and Displaying an Image. |
|
2. |
Add two command buttons to your form and name them as follows: |
|
|
Name |
Caption |
|
ZoomIn |
Zoom In |
|
ZoomOut |
Zoom Out |
3. |
Code the ZoomIn button's click procedure as follows: |
Private Sub ZoomIn_Click()
LEADRasterView1.AutoSetRects = True
LEADRasterView1.PaintSizeMode = PAINTSIZEMODE_ZOOM
LEADRasterView1.PaintZoomFactor = LEADRasterView1.PaintZoomFactor + 10
End Sub
4. |
Code the ZoomOut button's click procedure as follows: |
Private Sub ZoomOut_Click()
LEADRasterView1.AutoSetRects = True
LEADRasterView1.PaintSizeMode = PAINTSIZEMODE_ZOOM
If LEADRasterView1.PaintZoomFactor > 10 Then
LEADRasterView1.PaintZoomFactor = LEADRasterView1.PaintZoomFactor - 10
End If
End Sub
5. |
Run your program to test it. |