Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: Zoom in and Zoom out of a image in Picturebox

104| Mon, 03 Dec 2007 21:12:00 GMT| vb6_noob| Comments (3)
Need help in trying to figure out how to zoom in and out of a image inside of a picturebox... can someone help?

Keywords & Tags: zoom, out, image, picturebox, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/560737/
 
«« Prev - Next »» 3 helpful answers below.
Here is a very simple logic:

Public Sub ZoomPicture(pct As PictureBox, zoom As Double)
With pct
.Width = .Width * zoom
.Height = .Height * zoom
.PaintPicture .Picture, 0, 0, .ScaleWidth, .ScaleHeight
End With
End Sub

'usage (I had two buttons in control array)
Private Sub Command1_Click(index As Integer)
'============================================

If index = 0 Then
ZoomPicture Picture1, 1.1
Else
ZoomPicture Picture1, 0.9
End If

End Sub

edit: erased some unnecessary declaration.

rhinobull | Mon, 03 Dec 2007 18:29:00 GMT |

You can use the ScaleX and ScaleY properties of the Picturebox to zoom in or zoom out the picture.

Pradeep

pradeep1210 | Mon, 03 Dec 2007 18:30:00 GMT |

I know this code I've made is advanced, but it's a really cool and super fast way to Zoom in and out an image.

http://www.vbforums.com/attachment.php?attachmentid=34735

jacobroman | Mon, 03 Dec 2007 18:32:00 GMT |

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories