Article View: comp.lang.basic.visual.3rdparty
Article #84Re: A Scrollable Graphics Viewport - Problem/Question
From: Rob
Date: Fri, 08 Dec 2000 20:45
Date: Fri, 08 Dec 2000 20:45
97 lines
4992 bytes
4992 bytes
Your statements "HScroll1.Top = Picture1.Height" and "VScroll1.Left =
Picture1.Width" place the scroll bars outside of Picture 1. To place the scroll
bars inside Picture1 and not overlapping, use something like this:
VScroll1.Top = 0
VScroll1.Left = Picture1.Width - VScroll1.Width
VScroll1.Height = Picture1.Height - HScroll1.Height
HScroll1.Left = 0
HScroll1.Top = Picture1.Height - HScroll1.Height
HScroll1.Width = Picture1.Width - VScroll1.Width
Rob
carlwward wrote:
> 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:
<3A31488E.449B4A42@slip.net>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.direct.ca!look.ca!wn4feed!worldnet.att.net!207.207.0.27!nntp2.aus1.giganews.com!nntp3.aus1.giganews.com!news1.giganews.com.POSTED!not-for-mailReferences:
<1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com> <Ab5Y5.37051$g6.16377624@news1.elmhst1.il.home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit 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-Thread: 111c14,5b6ffc9e012830f4 X-Google-Attributes: gid111c14,public X-Google-ArrivalTime: 2000-12-08 12:45:53 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.direct.ca!look.ca!wn4feed!worldnet.att.net!207.207.0.27!nntp2.aus1.giganews.com!nntp3.aus1.giganews.com!news1.giganews.com.POSTED!not-for-mail Message-ID: <3A31488E.449B4A42@slip.net> From: Rob <nwguy@slip.net> X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.basic.visual.3rdparty,fidonet.visual_basic,fj.comp.lang.visualbasic,no.it.programmering.visual-basic Subject: Re: A Scrollable Graphics Viewport - Problem/Question References: <1r4Y5.37029$g6.16368562@news1.elmhst1.il.home.com> <Ab5Y5.37051$g6.16377624@news1.elmhst1.il.home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 98 NNTP-Posting-Date: Fri, 08 Dec 2000 14:45:35 CST Organization: Giganews.Com - Premium News Outsourcing X-Trace: sv2-asous3nfdfOROVY8kozH1qyYWEGUTU/kjm1hky03Zrob5f9dXCcgquzkgadXXrG2yor/vUKZm6SuqOY!XfoKuGnYqM0= X-Complaints-To: abuse@GigaNews.Com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Date: Fri, 08 Dec 2000 20:45:35 GMT