Results 1 to 6 of 6

Thread: [RESOLVED] Zoom in picturebox that contains Shape controls.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Resolved [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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Zoom in picturebox that contains Shape controls.

    Not just the size but also the location.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: Zoom in picturebox that contains Shape controls.

    I will tell you the results in a couple of days. Thanks.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width