1 Attachment(s)
Vertical Scrollbar problem
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
Re: Vertical Scrollbar problem
@JM - could you .zip up and attach the whole project so we can have a 'play'?
1 Attachment(s)
Re: Vertical Scrollbar problem
Attached is a quick sample you may be able to adapt to your needs.
1 Attachment(s)
Re: Vertical Scrollbar problem
@Doogle
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.
1 Attachment(s)
Re: Vertical Scrollbar problem
Re: Vertical Scrollbar problem
@MarkT
Perfect. Thanks, I truely appreciate your effort.
EDIT:
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.