CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    25

    Anyone know how to zoom in a picture box

    I have an image and I can draw a rectangle on the image. However I don't have a clue as to zoom the image in on the rectangle that I have drawn. If the rectangle is drawn I want the picture to zoom in on that area on the mouseup event How can I do this?

  2. #2
    Join Date
    Jul 2010
    Posts
    82

    Re: Anyone know how to zoom in a picture box

    You have to write the code for this:


    Code:
    public Image PictureBoxZoom(Image img, Size size)
    {
        Bitmap bm = new Bitmap(img, Convert.ToInt32(img.Width * size.Width), Convert.ToInt32(img.Height * size.Height));
        Graphics grap = Graphics.FromImage(bm);
        grap.InterpolationMode = InterpolationMode.HighQualityBicubic; 
        return bm;
    }
    See more here:
    http://www.dotnetcurry.com/ShowArtic...ookieSupport=1

    Search for it in CodeGuru itself . I have not tested the code above, so please refer to that article. Zom is not available as part of the framework as I know it, so you'll have to write on if you need it.
    Last edited by CuteAssistant; July 29th, 2010 at 08:13 PM.

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

Featured