Results 1 to 3 of 3

Thread: scrolling

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    Federal Way, WA, USA
    Posts
    13
    How can I scroll inside a picturebox? I loaded a file which has like 20 lines of information. In order to see all of it, you have to be able to scroll. Any ideas?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That can be done with the textbox control

  3. #3
    Member
    Join Date
    Mar 2000
    Location
    Staffodshire, England
    Posts
    32

    Picture box scrolling

    Im not sure if it will work with text, but there is way to us scrollbars to view a picture if it is larger than the picture box, here is an example:

    Firstly, before you start, draw a picture box inside another, call the back picture box picturebox2 or whatever you want, call the front picture box, picturebox1 or what erver you want, load the text or picture into picturebox1.

    Private Sub Form_Load()
    Picture2.ScaleMode = vbPixels
    Picture1.AutoSize = True
    Picture1.BorderStyle = vbBSNone
    Picture1.Move 0, 0
    VScroll.Move Picture2.Left + Picture2.Width, Picture2.Top, VScroll.Width, Picture2.Height
    HScroll.Move Picture2.Left, Picture2.Top + Picture2.Height, Picture2.Width, HScroll.Height
    End Sub

    Private Sub HScroll_Change()
    Picture1.Left = -HScroll
    End Sub

    Private Sub HScroll_Scroll()
    HScroll_Change
    End Sub

    Private Sub mnuexit_Click()
    End
    End Sub

    Private Sub mnunew_Click()
    cmdopen_Click
    End Sub

    Private Sub mnusave_Click()
    cmdsaveas_Click
    End Sub

    Private Sub Picture1_Resize()
    If Picture2.ScaleHeight > Picture1.Height Then
    VScroll.Visible = False
    Else
    VScroll.Max = Picture1.Height - Picture2.ScaleHeight
    VScroll.LargeChange = VScroll.Max / 7
    VScroll.Value = 0
    VScroll.Visible = True
    End If
    If Picture2.ScaleWidth > Picture1.Width Then
    HScroll.Visible = False
    Else
    HScroll.Max = Picture1.Width - Picture2.ScaleWidth
    HScroll.LargeChange = HScroll.Max / 20
    HScroll.Value = 0
    HScroll.Visible = True
    End If
    End Sub

    Private Sub VScroll_Change()
    Picture1.Top = -VScroll
    End Sub

    Private Sub VScroll_Scroll()
    VScroll_Change
    End Sub

    E-mail me if this works!!

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