Scrolling a image inside a Picturebox

LeKr

New member
Joined
Mar 22, 2005
Messages
1
Programming Experience
Beginner
I have a picturebox on a form. The pictures I want to display in the picturebox are too big to fit into it. If I stretch to fit (make them smaller in this case), the picture doesn't look very good.

I'm thinking that if I add scroll bars to the form and somehow when the scroll bar is moved it fires an event to scroll the picture within the picturebox.

How would I go about using scroll bars to scroll the image either left/right or up/down?
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
Actually, you don't even need to write code to do that.
If you set the form's AutoScroll property to true and there are controls outside of the visible part of the form, it will automatically position scrollBars that enable you to scroll the form to see the rest of the controls.
So if your pictureBox is bigger than the form and you set the AutoScroll property to True, the form will have Scrollbars that move the pictureBox around.
 
Top Bottom