[RESOLVED] Zoom in picturebox that contains Shape controls.
I've accomplished the zoom in using images. And I've used this:
Code:
Public Sub ZoomImage(ByRef ZoomValue As Int32)
Dim original As Image
'Get our original image
original = PictureBox1.Image
'Create a new image based on the zoom parameters we require
Dim zoomImage As New Bitmap(original, (Convert.ToInt32(original.Width * ZoomValue) / 100), (Convert.ToInt32(original.Height * ZoomValue / 100)))
'Create a new graphics object based on the new image
Dim converted As Graphics = Graphics.FromImage(zoomImage)
'Clean up the image
converted.InterpolationMode = InterpolationMode.HighQualityBicubic
'Clear out the original image
PictureBox1.Image = Nothing
'Display the new "zoomed" image
PictureBox1.Image = zoomImage
End Sub
The problem is that I've shape controls (rectangle and lines) in the picture box and I want to zoom in / zoom out them. I've tried different codes, but at the moment I'm still searching the solution.
Re: Zoom in picturebox that contains Shape controls.
You're going to do maths yourself. It's simple maths, i.e. just straight +, -, * and /. Nothing fancy. If you've done maths at school then you can do this. Once you have the maths worked out, then you can write code to implement it. If you don't know what you're implementing then obviously you won't be able to implement it, so don't even think about writing code until you have the maths worked out.
Re: Zoom in picturebox that contains Shape controls.
Are you refering to change the size of the shape control?
Rectangle1.Height = Rectangle1.Height * ZoomOutValue
I think you're refering to that.
Re: Zoom in picturebox that contains Shape controls.
Not just the size but also the location.
Re: Zoom in picturebox that contains Shape controls.
I will tell you the results in a couple of days. Thanks.
Re: Zoom in picturebox that contains Shape controls.
It works, thank you. Even it doesn't need the picturebox control because I draw the shapes directly on the form.