Can someone help me with the code to use scrollbars? I'm having a picturebox in a frame
which I need to move using the scrollbars.
Urgent. Please help.
Suresh.
Printable View
Can someone help me with the code to use scrollbars? I'm having a picturebox in a frame
which I need to move using the scrollbars.
Urgent. Please help.
Suresh.
To move the picturebox itself , which is what you are trying to do i believe, place horisontal and vertical scrollbars in the frame , extend them to the frame extends, use the scroll bars scange event, and assign the picturebox "TOP" or "LEFT" property to the ScrollBar "VALUE" property. Look at the picture moves!
Hope it helps.
On a form put a frame and on the frame put a picturebox and a vert. scroll bar and try this code...
private Sub Form_Load()
'no border on frame
Frame1.BorderStyle = 0
'set pictbox coords in frame...
Picture1.Top = Frame1.Top
Picture1.Left = Frame1.Left
Picture1.Picture = LoadPicture("Picturename.bmp")
Picture1.Height = Picture1.Image.Height
VScroll1.Min = 1
VScroll1.Max = 100
End Sub
private Sub VScroll1_Change()
Dim sPctNum as Single
sPctNum = (Picture1.Height - Frame1.Height) * (VScroll1.Value / 100)
Picture1.Top = -sPctNum
End Sub