|
-
Feb 28th, 2009, 07:47 AM
#1
Thread Starter
Lively Member
[RESOLVED] Image and ScrollBars
How can control a large image (larget than 1024*768) by two scrollbars ?
-
Feb 28th, 2009, 07:58 AM
#2
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
-
Feb 28th, 2009, 10:10 AM
#3
Thread Starter
Lively Member
Re: Image and ScrollBars
Very easy ...
THANKS !
-
Feb 28th, 2009, 10:12 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|