Results 1 to 4 of 4

Thread: [RESOLVED] Image and ScrollBars

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    85

    Resolved [RESOLVED] Image and ScrollBars

    How can control a large image (larget than 1024*768) by two scrollbars ?

  2. #2
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Image and ScrollBars

    Place a picturebox, and place an another picturebox inside the first picbox.
    You just have to set the scrollbar's Max value (at when you load the picture); to the size, that will never move your picture out of the boundaries.


    Code:
    Picture2.AutoSize = True 'Let the picturebox to resize itself to fit the image.
    Picture2.Top = 0 'move to the 0.
    Set Picture2.Picture = LoadPicture("C:\mypic.bmp") 'load the image
    VScroll1.Value = 0
    VScroll1.Max = Picture2.ScaleHeight - Picture1.ScaleHeight 'set the scrollbar size
    Now, you can move the scrollbar.
    Code:
    Private Sub VScroll1_Scroll()
      Picture2.Top = -VScroll1.Value
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    85

    Re: Image and ScrollBars

    Very easy ...
    THANKS !

  4. #4
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Image and ScrollBars

    Sure thing
    Just dont forget to set the tread as Resolved, if your problem is gone. Go up to thread tools menu, here in this thread, and select Mark thread as resolved, that helps to the others to find a solution.

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