Results 1 to 6 of 6

Thread: Vertical Scrollbar problem

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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
    Attached Images Attached Images  


    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width