Results 1 to 3 of 3

Thread: wann a scroll bar on form

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Pune
    Posts
    4

    Angry

    hi
    i want set the scroll bar on a form.
    becoz the application form exceeds the vb form
    plz help me asap
    bye
    sandesh

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    Try this.
    Code:
    Dim VPos As Integer
    Dim HPos As Integer
    
    Private Sub Form_Load()
        'Change the following numbers to the Full height and width of your Form
        intFullHeight = 8000
        intFullWidth = 8000
        'This is the how much of your Form is displayed
        intDisplayHeight = Me.Height
        intDisplayWidth = Me.Width
    
        With VScroll1
            .Height = Me.ScaleHeight
            .Min = 0
            .Max = intFullHeight - intDisplayHeight
            .SmallChange = Screen.TwipsPerPixelX * 10
            .LargeChange = .SmallChange
        End With
        With HScroll1
            .Width = Me.ScaleWidth
            .Min = 0
            .Max = intFullWidth - intDisplayWidth
            .SmallChange = Screen.TwipsPerPixelX * 10
            .LargeChange = .SmallChange
        End With
    End Sub
    
    Sub ScrollForm(Direction As Byte)
        Dim CTL As Control
        
        'Scroll Vertically
        If Direction = 0 Then
            For Each CTL In Me.Controls
                'Make sure it's not a ScrollBar
                If Not (TypeOf CTL Is VScrollBar) And Not (TypeOf CTL Is HScrollBar) Then
                    'If it's a Line then
                    If TypeOf CTL Is Line Then
                        CTL.Y1 = CTL.Y1 + VPos - VScroll1.Value
                        CTL.Y2 = CTL.Y2 + VPos - VScroll1.Value
                    Else
                        CTL.Top = CTL.Top + VPos - VScroll1.Value
                    End If
                End If
            Next
            VPos = VScroll1.Value
        Else
            'Scroll Horizontally
            For Each CTL In Me.Controls
                'Make sure it's not a ScrollBar
                If Not (TypeOf CTL Is VScrollBar) And Not (TypeOf CTL Is HScrollBar) Then
                    'If it's a Line then
                    If TypeOf CTL Is Line Then
                        CTL.X1 = CTL.X1 + HPos - HScroll1.Value
                        CTL.X2 = CTL.X2 + HPos - HScroll1.Value
                    Else
                        CTL.Left = CTL.Left + HPos - HScroll1.Value
                    End If
                End If
            Next
            HPos = HScroll1.Value
        End If
    End Sub
    
    Private Sub HScroll1_Change()
        ScrollForm 1
    End Sub
    
    Private Sub HScroll1_Scroll()
        ScrollForm 1
    End Sub
    
    Private Sub VScroll1_Change()
        ScrollForm 0
    End Sub
    
    Private Sub VScroll1_Scroll()
        ScrollForm 0
    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