Solved

how to scroll a picture box...

Posted on 2000-04-12
8
222 Views
Last Modified: 2010-05-18
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
Comment
Question by:Ra
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Accepted Solution

by:
Crin earned 100 total points
ID: 2709202
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2709217
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2709281
0
 

Author Comment

by:Ra
ID: 2709349
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Expert Comment

by:Ruchi
ID: 2709362
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2709366
Too late!!! No problem ;-)
0
 

Author Comment

by:Ra
ID: 2709380
hehe, sorry Ruchi.  Crin did get to it first and the page you linked to said pretty much the same thing.  Thanks anyways.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2709385
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now