Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zooming and panning on PictureBoxes 1

Status
Not open for further replies.

jlipsitz

Programmer
Jul 13, 2003
14
US
Hi,

I was wondering how I could do zooming operations and also pan an image inside a PictureBox.

Is there a built in method like there is for flipping and rotating an image? If not what is the best way to zoom and pan an image inside a picturebox.

Thanks
 
Thanks for that article. Do you have any idea how you would pan an image?

Thanks
 
you can move is by ajusting the line that calls bitmap.setpixel so the the image is placed at x+dx,y+dy rather than x,y (where dx and dy are how far you want to shift the thing).

note - make sure your bitmap is large enough to fit your shifted picture on (unless you want it to crop where it goes over the edge).

note2 - think about what you're going to do with the blank space left when it was moved - like the clean bit i found under a rug i turned round the other day, i'm going to have to think about.
 
By pan I mean that the user (after zooming in on the image) should be able to click on the image and view the parts of the image that are outside of the picturebox's viewing area by moving around the mouse.

Thanks
 
interestingly enough i programmed what you're doing just the other day, but i didn't use a picture box. i used a panel, then added the image in the paint event using PaintEventArgs.Graphics.DrawImage - which allows any size picture to be placed anywhere.
...zoom and pan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top