Solved

how to scroll a picture box...

Posted on 2000-04-12
8
226 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 64
message box in access 4 51
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 54
Set WorkSheet  not Working 9 38
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

808 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