Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll an image? 1

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
Is there any control that will show the true size of an image and let you scroll, instead of having the resize set to true?? Rob
Just my $.02.
 
The picture box shows the image full size, but
without scrolling (as you no doubt know).

There is a really good example of how to do what you want
in the MSDN help thingy - MSDN Library visual studio 6.
I don't know if this is standard with VB6 or not...

If you have it, do a search in the help index for
"scrollable graphics viewport sample".

It's really too big to copy it all to here, plus I might
be breaching some sort of copyright law.

Anyway, to summarize, they use one picture box within
another picture box and a vertical and horizontal scroll bar. The inner picture box is set to Autosize.
When you click on the scroll bars, the inner picture box is
repositioned relative to the outer picture box.
like this:

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

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


I hope this helps.
If you have the help article, you are set.
 
These bits will help too...


HScroll1.Max = Picture2.Width - Picture1.Width
VScroll1.Max = Picture2.Height - Picture1.Height


:)
 

Also, I noticed this earlier posting on the subject.

thread222-62514
 
Thanks for the reply NonGuru. I'll have a look at it. Rob
Just my $.02.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top