Results 1 to 2 of 2

Thread: frames and scroll bar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106

    Question

    Does anyone know how to sue scroll bar so that the things in frames move up and down when you use vertical scroll bar?
    I need to fit in around 30 textboxes in a frame but i would like to make it so that user only sees 10 textboxes, so I need a scroll bar to let the user get access to all the textboxes and manage to store all the textboxes in the frame

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Add a Frame to the Form, Add a Picturebox to the Frame (picFrame), add another Picturebox inside picFrame (picContainer), add a scrollbar into picFrame and add the Textboxes to picContainer:
    Code:
    Private Sub Form_Load()
        Dim lCount As Long
        Dim oCTRL As Control
        
        picFrame.BorderStyle = vbBSNone
        picContainer.BorderStyle = vbBSNone
        picFrame.ScaleMode = vbPixels
        Set picContainer.Container = picFrame
        Set picFrame.Container = Frame1
        Set VScroll1.Container = picFrame
        If picContainer.Height < picFrame.ScaleHeight Then picContainer.Height = picFrame.ScaleHeight * 2
        VScroll1.Move picFrame.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, picFrame.ScaleHeight
        picContainer.Move 0, 0
        picFrame.Move 70, 200
        picContainer.Width = picFrame.ScaleWidth - VScroll1.Width
        VScroll1.Max = picContainer.Height - picFrame.ScaleHeight
        For Each oCTRL In Controls
            If oCTRL.Container.Name = "picContainer" Then lCount = lCount + 1
        Next
        If lCount Then VScroll1.LargeChange = VScroll1.Max / lCount
    End Sub
    
    Private Sub VScroll1_Change()
        picContainer.Move 0, -VScroll1
    End Sub
    
    Private Sub VScroll1_Scroll()
        VScroll1_Change
    End Sub

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