Article View: comp.lang.basic.visual.3rdparty
Article #83Re: A Scrollable Graphics Viewport - Problem/Question
From: carlwward
Date: Fri, 08 Dec 2000 13:17
Date: Fri, 08 Dec 2000 13:17
81 lines
4153 bytes
4153 bytes
I should have added that I started by creating a new project and then
drawing two picture boxes (#2 inside of #1), a horizontal scroll bar (inside
of picture box #1), and a vertical scroll bar (also inside of picture box
#1), on the form.
Carl Ward
"carlwward" <carlwward@home.com> wrote in message
news:1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com...
> 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:
<Ab5Y5.37051$g6.16377624@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-mailReferences:
<1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c14,5b6ffc9e012830f4 X-Google-Attributes: gid111c14,public X-Google-Thread: 109af3,5b6ffc9e012830f4 X-Google-Attributes: gid109af3,public X-Google-Thread: f5f6f,5b6ffc9e012830f4 X-Google-Attributes: gidf5f6f,public X-Google-Thread: 107824,5b6ffc9e012830f4 X-Google-Attributes: gid107824,public X-Google-ArrivalTime: 2000-12-08 05:17:21 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 References: <1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com> Subject: Re: A Scrollable Graphics Viewport - Problem/Question Lines: 83 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: <Ab5Y5.37051$g6.16377624@news1.elmhst1.il.home.com> Date: Fri, 08 Dec 2000 13:17:20 GMT NNTP-Posting-Host: 24.19.127.238 X-Complaints-To: abuse@home.net X-Trace: news1.elmhst1.il.home.com 976281440 24.19.127.238 (Fri, 08 Dec 2000 05:17:20 PST) NNTP-Posting-Date: Fri, 08 Dec 2000 05:17:20 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster