controlling scrolling in a form programatically?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Scott M (scottmacebay_at_tiscali.co.uk)
Date: 06/02/04


Date: 2 Jun 2004 09:20:44 -0700

Hi,

I am currently trying to write a simple game using vb.net

the form I am working on is 800*600 (this is set as the maximum size)
and autoscroll is set to true. The user moves around the screen by
moving a picturebox (sprite) with the cursor keys.

When the user hits the bottom of the screen I want the screen to
automatically scroll down to keep the picture box in view - The screen
I want to work with is 800*1200 but the window should not resize above
800*600. I would also like to keep a status bar (just a text box) on
the bottom line of the screen (displaying lives etc - this needs to
remain fixed even if the screen scrolls)

Any ideas?

I had a couple of ideas myself - create a "background" picture box
that is 800*1200 (this then displays scroll bars in the form). Then
create a couple of hidden picture boxes, one at the top of the screen
and one at the bottom of the screen. When the user moves the sprite
picture box below the bottom of the form (y>=600) then move focus to
the bottom picture box. And when they move above this (y<600) focus
on the top picture box. In this way the form appears to auto scroll.

However, this means that the status bar gets lost when the screen
scrolls (although I suppose I could move this programatically when the
screen moves). Of course I'll need to trap the user scrolling around
the form themselves as well.

Also heard about mdi forms (never used them though) would I be able to
have the scrolling form as a child with the status bar as a parent?

Finally, how do you programatically scroll a form - I couldn't find
any obvious commands like scrollwindow(x,y)?

thanks in advance

Scott M.



Relevant Pages

  • Re: Firefox development (Was: Wanted: talented programmers)
    ... At 2 min the icon appeared on the icon bar. ... At 2 min 30 sec a blank screen appeared with just the title bar. ... The top of the page stayed put and odd bits of the bottom ... I tried the little arrow at the top of the scroll bar and just ...
    (comp.sys.acorn.apps)
  • Re: Button on a sheet always visible
    ... Put in a split screen with the small area at the bottom. ... then drag the verticle bar to one side and drag the ... That way it will be hidden when any other sheet is ... >> the bottom which will not move up as I scroll the sheet. ...
    (microsoft.public.excel.programming)
  • Re: Button on a sheet always visible
    ... Tom Ogilvy Wrote: ... > Put in a split screen with the small area at the bottom. ... > horizontal bar toward the bottom ... Is it possible to sense scroll position of the sheet ...
    (microsoft.public.excel.programming)
  • OT: About Kevie, or Kevin, or KSW or Kevin S??? Wilson
    ... Scroll ... down to the bottom. ... Note his dress; note the cynical look on his face; ... the end of the bar. ...
    (alt.food.barbecue)
  • controlling scrolling in a form programatically
    ... When the user hits the bottom of the screen I want the screen to ... I had a couple of ideas myself - create a "background" picture box ... that is 800*1200 (this then displays scroll bars in the form). ... this means that the status bar gets lost when the screen ...
    (microsoft.public.dotnet.languages.vb)