Picturebox image zoom + moving function
Hello,
I would like to fit an image in a picturebox but without strechting it like :
VB Code:
"PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage"
Just a zoom where the full picture is displayed like in IE6.
Second thing I try to do is to allow user to move the picture inside the picturebox when the original picture is bigger than the picturebox.
Thanks
:p
The solution for the Zoom
VB Code:
Dim Width As Integer
Dim Height As Integer
Dim Ratio As Decimal
If PictureBox1.Tag > -1 And Not PictureBox1.Tag Is Nothing Then
If RadioButton1.Checked = True Then 'Option Zoom 100%
Height = PictureArray(PictureBox1.Tag).Height
Width = PictureArray(PictureBox1.Tag).Width
Else
' Option Zoom Fit Image in Picturebox
Ratio = PictureArray(PictureBox1.Tag).width / PictureArray(PictureBox1.Tag).height
If Ratio < (PictureBox1.Width / PictureBox1.Height) Then
Height = PictureBox1.Height
Width = PictureBox1.Width * Ratio
Else
Height = PictureBox1.Height / Ratio
Width = PictureBox1.Width
End If
End If
PictureBox1.Image = PictureArray(PictureBox1.Tag).GetThumbnailImage(Width, Height, Nothing, Nothing)
End If
Does anyone know How can I move the Image if it is bigger than the picturebox ??? (scrollbar or mouse event)
:confused: :D