Scrolling Picture Box

Pirahnaplant

Well-known member
Joined
Mar 29, 2009
Messages
75
Programming Experience
3-5
How can a make a picture box that can allow the user to scroll through the image?
 
put a panel , picturebox , Hscroll & Vscroll on your form , after that import your favorite picture.
then , on form load event :
VB.NET:
    HScrollBar1.Maximum = PictureBox1.Width
        VScrollBar1.Maximum = PictureBox1.Height
on HScrollBar1_Scroll event
VB.NET:
      PictureBox1.Left = -HScrollBar1.Value()
on VScrollBar1_Scroll event
VB.NET:
   PictureBox1.Top = -VScrollBar1.Value()
that's all , you can improve this code by adding some nice features , like Zoom facility
have nice day
 
you could also just put a picture box in a panel, set the panels autoscroll setting to true and the picturebox sizemode to autosize see attached

Sorry i cant put more explanation into this (is why i have the attachement)
 

Attachments

  • pictureBox.zip
    13.8 KB · Views: 87
Last edited by a moderator:
Back
Top