Solved

how to scroll a picture box...

Posted on 2000-04-12
8
221 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 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

9 Experts available now in Live!

Get 1:1 Help Now