I have this picturebox image scroll that I have all the images in it and everything is all in there correctly and the only problem I have is with the vertical scroll bar. I need to be able to move the scroll bar up and down and have it move the images up and down by one complete image (i.e. no scrolling where images are partially shown) so that there is always three images showing at a time and when clicking on the up/down thumbnail buttons it is to scroll by one image only. Here is my code but I don't know how to get it to work. Also I attach a picture showing how the image scroller looks with the dimensions.
Code:
Dim NumberOfPictures As Integer
Const MaxPicturesToShow = 3
Private Sub Form_Load()
picScroll.Top = 0
picScroll.Height = picImage(0).Height + 26
VScrollBar.SmallChange = 1
VScrollBar.LargeChange = picHolder.Height
End Sub
Private Sub UpdateScrollBar()
On Error GoTo EH
If Counter > MaxPicturesToShow Then
VScrollBar.Enabled = True
VScrollBar.Visible = True
VScrollBar.Min = 0
VScrollBar.Max = (picScroll.ScaleHeight - picHolder.ScaleHeight)
Else
' Do Nothing
End If
Exit Sub
EH:
End Sub
Private Sub Form_Activate()
VScrollBar.Value = 0
End Sub
Private Sub VScrollBar_Change()
'
' ?????
'
End Sub
Private Sub VScrollBar_GotFocus()
Command1.SetFocus
End Sub
Private Sub VScrollBar_Scroll()
'
' This works but it is not what I need. I need it to only scroll
' one full image height up/down and not scroll through partial
' images.
'
picScroll.Top = -(VScrollBar.Value)
End Sub
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Here is my project. The three horizontal lines are just for testing alignment. Colors are for identifying only. Just click on button to load the images. For the small up/down button it should scroll one full image up/down and the alignment should be on the test lines. For large scroll the same thing as small scroll
EDIT
Important - The three horizontal alignment lines are always at the top of each of the three images but note that each image has a black border around it. The alignment lines are not at the top of these lines as the borders are drawn around the outside of the image boundaries on picScroll. The image that is at the top of the list must always be 3-pixels down from the top so that I can draw a 1-pixel or a 3-pixel wide border around the image. Clicking on any image puts a 3-pixel border around it while the others have only a 1-pixel border. When the first image is loaded it will have the 3-pixel border. Also, the image scroller is inside of a Frame so that may have an impact on the measurements.
Last edited by jmsrickland; Aug 19th, 2012 at 01:03 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Stupid rep thing. I can't rate you right now because it says I have to spread some more around elsewhere before giving it to you again.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.