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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll Bars

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have a form that I am using to view scanned documents(jpg files)..I need to put scroll bars (horizontal and vertical) I am getting it to work but there are still problems.

I am using a image box to display the pic. now ever since i added the scroll bars the pic will go out side the image box..how can i make the pic stay inside the box no matter what and just you the scroll bars to view the rest of the pic??

I cant seem to make horizontal scroll bars to work..

heres my code below.

Private Sub HScroll1_Change()
Image1.Left = HScroll1.Value
End Sub

Private Sub VScroll1_Change()
Image1.Top = -VScroll1.Value
End Sub


Thanks in advance



dvannoy@onyxes.com
 
use a picturebox(PB) inside a picturebox.
place PB1 where you want it in the form and place PB2 inside PB1. Next, place scrollbars(SB) under and to the right of PB2. Set the scalemode property of all three to pixels. Set the autosize property of PB2 to true.

Form1_Load()
PB2.picture=loadpicture("Your jpeg file here")
VSB.max=PB2.hieght-PB1.hieght
HSB.max=PB2.width-PB1.width
end sub

HSB_Scroll()
PB2.Left = -HSB.Value
End Sub

VSB_Scroll()
PB2.Top = -VSB.Value
End Sub



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top