|
-
Jun 23rd, 2003, 05:43 AM
#1
Thread Starter
Lively Member
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
-
Jun 23rd, 2003, 11:21 AM
#2
I wonder how many charact
Its easy to fit a picture inside a picturebox... without stretching. The problem is that making the picture appear normal requires a design decision on your part...
Since an image may have dimensions of 450 x 200, but your picturebox may be 600 X100 (extreme example), you can't simply assign it, or you lose the proportions of the original image's height and width. In an image of 450 x 200, you have a proportion of 2.25 : 1. While your picturebox has a proportion of 6:1. That's a problem.
So, do you want to expand your picturebox dimensions to fit the image? Or do you scale in/out the image to fit the dimensions of the picturebox?
-
Jun 23rd, 2003, 01:11 PM
#3
Thread Starter
Lively Member
I would like to scale a copy of the picture into the picturebox.
That's the picture who should be resized, not the piturebox.
Original image is keep to be saved later.
Thanks
-
Jun 25th, 2003, 11:57 AM
#4
Thread Starter
Lively Member
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)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|