Move an image

hemza

Member
Joined
Jan 15, 2009
Messages
6
Programming Experience
5-10
Hi,

Let us say that I have a picture pct.png (map for an RPG) with size 1000x1000. I want to put a code that will display a 300x300 region of it inside
1) a form's/panel's backgroundimage
2) a picturebox
all of size 300x300

In other words, I want to give as input x,y,width,height (in my case width=300 and height=300) and some code would return a drawing.image object containing the region of pct.png defined by the rectangle (x,y,300,300). I hope it is clear...

Another way to see this, is how do I move a huge picture inside a small picture box?

Thank you
 
Add 300x300 Panel to Form, add Picturebox to Panel. Set AutoSize for the picturebox to value "AutoSize", which make it size to full image size. Set AutoScroll for the panel to value "True", which means when child controls take more place than panel size it will add scrollbars, which will give the effect you want.
 
Back
Top