Link to home
Start Free TrialLog in
Avatar of Ockwig
Ockwig

asked on

VB Scrollbar Question

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
ASKER CERTIFIED SOLUTION
Avatar of DocM
DocM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DocM
DocM

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 
This page will be more appropriate.
HOWTO: Create Scrollable Viewports
http://support.microsoft.com/default.aspx?scid=kb;en-us;186429
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
and put picInner and the scrollbars in picOuter   ;)

sorry... tired
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?
Avatar of DanRollins
Moderator, my recommended disposition is:

    Split points between: DocM and DeAn

DanRollins -- EE database cleanup volunteer