Results 1 to 6 of 6

Thread: Vertical Scrollbar problem

  1. #1
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,886

    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  
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  2. #2
    PowerPoster
    Join Date
    Jul 06
    Location
    Maldon, Essex. UK
    Posts
    5,387

    Re: Vertical Scrollbar problem

    @JM - could you .zip up and attach the whole project so we can have a 'play'?

  3. #3
    PowerPoster
    Join Date
    Jun 01
    Location
    Trafalgar, IN
    Posts
    3,480

    Re: Vertical Scrollbar problem

    Attached is a quick sample you may be able to adapt to your needs.
    Attached Files Attached Files

  4. #4
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,886

    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.
    Attached Files Attached Files
    Last edited by jmsrickland; Aug 19th, 2012 at 01:03 PM.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  5. #5
    PowerPoster
    Join Date
    Jun 01
    Location
    Trafalgar, IN
    Posts
    3,480

    Re: Vertical Scrollbar problem

    See if that does it.
    Attached Files Attached Files

  6. #6
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,886

    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.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

Posting Permissions

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