🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual.3rdparty
Article #82

A Scrollable Graphics Viewport - Problem/Question

#82
From: carlwward
Date: Fri, 08 Dec 2000 12:25
64 lines
3603 bytes
Hi all,

I got the following code out of the MSDN Library Visual Basic Studio 6.0
documentation file.  It supposedly is an example of how to use Scroll Bar
Controls for Creating a Scrollable Graphics Viewport.  But it doesn't work.
Here's the problem.

The graphic is in fact displayed in the Picture2 control box. Picture1
control box displays space for the horizontal scroll bar control and for the
vertical scroll bar control, but the scroll bars are actually not displayed
in that space, if anywhere.

Can someone tell me what's wrong?  Could it be that the version of Visual
Basic that I have is not completely compatible with Win98, Extended Edition?

Would sure appreciate some help here and thanks in advance.

Carl Ward

Private Sub Form_Load()
   ' Set ScaleMode to pixels.
   Form1.ScaleMode = vbPixels
   Picture1.ScaleMode = vbPixels
   ' Autosize is set to True so that the boundaries of
   ' Picture2 are expanded to the size of the actual
   ' bitmap.
   Picture2.AutoSize = True
   ' Set the BorderStyle of each picture box to None.
   Picture1.BorderStyle = 0
   Picture2.BorderStyle = 0
   ' Load the bitmap.
   Picture2.Picture = _
   LoadPicture("c:\Windows\Winlogo.bmp")
   ' Initialize location of both pictures.
   Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, _
   ScaleHeight - HScroll1.Height
   Picture2.Move 0, 0
   ' Position the horizontal scroll bar.
   HScroll1.Top = Picture1.Height
   HScroll1.Left = 0
   HScroll1.Width = Picture1.Width
   ' Position the vertical scroll bar.
   VScroll1.Top = 0
   VScroll1.Left = Picture1.Width
   VScroll1.Height = Picture1.Height
   ' Set the Max property for the scroll bars.
   HScroll1.Max = Picture2.Width - Picture1.Width
   VScroll1.Max = Picture2.Height - Picture1.Height
   ' Determine if the child picture will fill up the
   ' screen.
   ' If so, there is no need to use scroll bars.
   VScroll1.Visible = (Picture1.Height < _
   Picture2.Height)
   HScroll1.Visible = (Picture1.Width < _
   Picture2.Width)
End Sub

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

Private Sub VScroll1_Change()
   Picture2.Top = -VScroll1.Value
End Sub
Technical Details
Message-ID: <1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.elmhst1.il.home.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5f6f,5b6ffc9e012830f4,start
X-Google-Attributes: gidf5f6f,public
X-Google-Thread: 109af3,5b6ffc9e012830f4,start
X-Google-Attributes: gid109af3,public
X-Google-Thread: 111c14,5b6ffc9e012830f4,start
X-Google-Attributes: gid111c14,public
X-Google-Thread: 107824,5b6ffc9e012830f4,start
X-Google-Attributes: gid107824,public
X-Google-ArrivalTime: 2000-12-08 04:25:35 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.elmhst1.il.home.com.POSTED!not-for-mail
From: "carlwward" <carlwward@home.com>
Newsgroups: comp.lang.basic.visual.3rdparty,fidonet.visual_basic,fj.comp.lang.visualbasic,no.it.programmering.visual-basic
Subject: A Scrollable Graphics Viewport - Problem/Question
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com>
Date: Fri, 08 Dec 2000 12:25:33 GMT
NNTP-Posting-Host: 24.19.127.238
X-Complaints-To: abuse@home.net
X-Trace: news1.elmhst1.il.home.com 976278333 24.19.127.238 (Fri, 08 Dec 2000 04:25:33 PST)
NNTP-Posting-Date: Fri, 08 Dec 2000 04:25:33 PST
Organization: Excite@Home - The Leader in Broadband http://home.com/faster