• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

how to scroll a picture box...

Hey all, I am developing an application for the Win32 enviroment in VB 6.  What I have is a form that has a picture box on it.  In this picture box is another picrute box with index of 0.  Other picture boxes may be loaded at run time, up to 24.  These will be tiled in the main picture box.  The main picture box has been sized to hold 6 (3*2)of the smaller boxes.  My question is how to make the main picture box able to scroll to show the rest of the smaller boxes.  I have tried the pager control at CCRP, but I couldn't get it to work.  Any suggestions on how I might accomplish this task?  I am willing to use a control other then a picture box if need be.

Thanks.
0
Ra
Asked:
Ra
  • 3
  • 2
  • 2
  • +1
1 Solution
 
CrinCommented:
Hello
Add Another picturebox, name it "SuperMain" :)) place your picturebox into SuperMain picturebox, set your main picturebox appearence to 'flat' adjust color....
Now you can move your main picturebox (with small ones) inside SuperMain using

PictureBox1.move x,y,width,height

Enjoy :))

Sincerely yours,

Crin
0
 
RuchiCommented:
From the MSDN Library under the topic of "ScrollBar Controls Scenario: Creating a Scrollable Graphics Viewport" in the Visual Basic Documentation. Or, you can check this site: http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbcon98/vbconscrollbarcontrolsscenariocreatingscrollablegraphicsviewport.htm 
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
RaAuthor Commented:
Thanks Crin.  Your answer worked prefectly.  I just set the left of the picture box to a negitive value rather then using that move function.  It works just the same.  Thanks again. :)
0
 
RuchiCommented:
Place two Pictureboxes, a vertical scrollbar and a horizontal scrollbar on the Form. Place Picture1 within Picture2 and Load the Picture you want to scroll into Picture1. This is just to give you an idea....

Option Explicit

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

Private Sub HScroll1_Change()
    Picture1.Left = -HScroll1
End Sub

Private Sub HScroll1_Scroll()
    HScroll1_Change
End Sub

Private Sub VScroll1_Change()
    Picture1.Top = -VScroll1
End Sub

Private Sub VScroll1_Scroll()
    VScroll1_Change
End Sub

Private Sub Picture1_Resize()
    If Picture2.ScaleHeight < Picture1.Height Then
        VScroll1.Visible = False
    Else
        VScroll1.Max = Picture1.Height - Picture2.ScaleHeight
'        VScroll1.LargeChange = VScroll1.Max / 10
        VScroll1.Value = 0
        VScroll1.Visible = True
    End If
    If Picture2.ScaleWidth < Picture1.Width Then
        HScroll1.Visible = False
    Else
        HScroll1.Max = Picture1.Width - Picture2.ScaleWidth
 '       HScroll1.LargeChange = HScroll1.Max / 10
        HScroll1.Value = 0
        HScroll1.Visible = True
    End If
End Sub
0
 
RuchiCommented:
Too late!!! No problem ;-)
0
 
RaAuthor Commented:
hehe, sorry Ruchi.  Crin did get to it first and the page you linked to said pretty much the same thing.  Thanks anyways.
0
 
CrinCommented:
Hope my comments was useful for you :)

Thank you for the points - it's interesting to me yet, because I'm second day here, on EE :))

Sincerely yours,

Crin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now