?
Solved

VB Scrollbar Question

Posted on 2003-03-01
9
Medium Priority
?
243 Views
Last Modified: 2010-05-01
I have a innerpicture in a outerpicture on a form and the innerpicture is bigger than the viewing size, I want to be able to center these picture on a form and use the scrollbars to move the innerpicture around so I can see the whole thing when I scroll, without the inner picture bleeding over onto the outerpicture, anyone have any suggestions?
Thanks
Jerry
ockwig@ureach.com
0
Comment
Question by:Ockwig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 3

Accepted Solution

by:
DocM earned 100 total points
ID: 8049742
Check this out:

HOWTO: Scroll a Form When VB Forms Are Limited to Screen Size

http://support.microsoft.com/default.aspx?scid=kb;en-us;109741 
0
 
LVL 3

Expert Comment

by:DocM
ID: 8049781
Check this out:

HOWTO: Scroll a Form When VB Forms Are Limited to Screen Size

http://support.microsoft.com/default.aspx?scid=kb;en-us;109741 
0
 
LVL 3

Expert Comment

by:DocM
ID: 8049832
This page will be more appropriate.
HOWTO: Create Scrollable Viewports
http://support.microsoft.com/default.aspx?scid=kb;en-us;186429
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Assisted Solution

by:DeAn
DeAn earned 100 total points
ID: 8049862
with the following controls on a form:
2 PictureBoxes: picInner, picOuter
1 VScrollBar: VScroll1
1 HScrollBar: HScroll1

Private Sub Form_Resize()
  picOuter.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  VScroll1.Move picOuter.Width - (picOuter.Width - picOuter.ScaleWidth) - VScroll1.Width, 0, VScroll1.Width, picOuter.ScaleHeight
  HScroll1.Move 0, picOuter.Height - (picOuter.Height - picOuter.ScaleHeight) - HScroll1.Height, picOuter.ScaleWidth - VScroll1.Width, HScroll1.Height
  VScroll1.Max = (picInner.ScaleHeight - picOuter.ScaleHeight)
  HScroll1.Max = (picInner.ScaleWidth - picOuter.ScaleWidth)
  HScroll1.LargeChange = HScroll1.Max / 20
  VScroll1.LargeChange = VScroll1.Max / 20
  HScroll1.SmallChange = HScroll1.Max / 50
  VScroll1.SmallChange = VScroll1.Max / 50
End Sub

Private Sub HScroll1_Change()
  picInner.Left = -HScroll1.Value
End Sub

Private Sub HScroll1_Scroll()
  HScroll1_Change
End Sub

Private Sub VScroll1_Change()
  picInner.Top = -VScroll1.Value
End Sub

Private Sub VScroll1_Scroll()
  VScroll1_Change
End Sub
0
 
LVL 3

Expert Comment

by:DeAn
ID: 8049929
oops, change the Form_Resize

Private Sub Form_Resize()
  picOuter.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
 
  If picInner.ScaleWidth > picOuter.ScaleWidth Then
    HScroll1.Move 0, picOuter.Height - (picOuter.Height - picOuter.ScaleHeight) - HScroll1.Height, picOuter.ScaleWidth - VScroll1.Width, HScroll1.Height
    HScroll1.Max = (picInner.ScaleWidth - picOuter.ScaleWidth)
    HScroll1.LargeChange = HScroll1.Max / 20
    HScroll1.SmallChange = HScroll1.Max / 50
    HScroll1.Visible = True
  Else
    HScroll1.Visible = False
  End If
   
  If picInner.ScaleWidth > picOuter.ScaleWidth Then
    VScroll1.Move picOuter.ScaleWidth - (picOuter.ScaleWidth - picOuter.ScaleWidth) - VScroll1.Width, 0, VScroll1.Width, picOuter.ScaleHeight
    VScroll1.Max = (picInner.ScaleHeight - picOuter.ScaleHeight)
    VScroll1.LargeChange = VScroll1.Max / 20
    VScroll1.SmallChange = VScroll1.Max / 50
    VScroll1.Visible = True
  Else
    VScroll1.Visible = False
  End If

End Sub

And make sure that picInner.AutoSize = True
0
 
LVL 3

Expert Comment

by:DeAn
ID: 8049945
and put picInner and the scrollbars in picOuter   ;)

sorry... tired
0
 

Expert Comment

by:CleanupPing
ID: 8940418
Ockwig:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9001835
Moderator, my recommended disposition is:

    Split points between: DocM and DeAn

DanRollins -- EE database cleanup volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

771 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