I have an image in a PictureBox and I want to be able to have buttons on my form that allow a user to zoom in and out as they wish. However, it doesn't seem like the .Zoom property works with the PictureBox. Is there another way around in this? Maybe a way to scale the PictureBox according to the same way .Zoom would work? Here's my code, but it did not zoom in or out:
Code:
Public Const ZOOM_MAX As Double = 25600
Public Const ZOOM_MIN As Double = 0.1
Private Sub mnuViewZoomIn_Click()
On Error GoTo ErrHandle
pic.Picture.Zoom = 2 * pic.Picture.Zoom
tbToolBar.Buttons("ZoomOut").Enabled = True
If pic.Picture.Zoom >= ZOOM_MAX Then
tbToolBar.Buttons("ZoomIn").Enabled = False
End If
Exit Sub
ErrHandle:
tbToolBar.Buttons("ZoomIn").Enabled = False
End Sub
Private Sub mnuViewZoomout_Click()
On Error GoTo ErrHandle
pic.Picture.Zoom = 0.5 * pic.Picture.Zoom
tbToolBar.Buttons("ZoomIn").Enabled = True
If pic.Picture.Zoom <= ZOOM_MIN Then
tbToolBar.Buttons("ZoomOut").Enabled = False
End If
Exit Sub
ErrHandle:
tbToolBar.Buttons("ZoomOut").Enabled = False
End Sub