Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Toolbar Scrolls with Window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bern11 - 13 Jun 2006 03:44 GMT
I have a main form with autoscroll and a menu docked top & left.  When I
scroll to the right or down, the menu moves off-screen.  How do I keep
that from happening?  (Do I have to set the location of the menu with
each scroll-bar move???).
Göran Andersson - 13 Jun 2006 14:50 GMT
Place the menu and a panel in the form, make the panel scrollable
instead of the form, and place the other controls on the panel.

> I have a main form with autoscroll and a menu docked top & left.  When I
> scroll to the right or down, the menu moves off-screen.  How do I keep
> that from happening?  (Do I have to set the location of the menu with
> each scroll-bar move???).
bern11 - 14 Jun 2006 02:44 GMT
Thanks for the advice.  It works great.  I'm a bit surprised though that
you have to do that.  I thought for sure there must be a 'dock to the
visible boundaries' settings somewhere....

> Place the menu and a panel in the form, make the panel scrollable
> instead of the form, and place the other controls on the panel.
[quoted text clipped - 3 lines]
>> keep that from happening?  (Do I have to set the location of the menu
>> with each scroll-bar move???).
Göran Andersson - 14 Jun 2006 09:01 GMT
That would require that the control would be excluded from the normal
positioning of child controls and instead be placed outside the actual
parent control, changing the size of the scrolling area. That would in
turn mean that the parent control would need three sets of coordinates,
one for the original position of the control, one for the scrolling area
that is left when the docked childen has been placed, and one for the
virtual area that is shown in the scrolling area.

It think that it's more straight forward to actually place the control
outside the area that should scroll. :)

> Thanks for the advice.  It works great.  I'm a bit surprised though that
> you have to do that.  I thought for sure there must be a 'dock to the
[quoted text clipped - 7 lines]
>>> do I keep that from happening?  (Do I have to set the location of the
>>> menu with each scroll-bar move???).
bern11 - 14 Jun 2006 22:08 GMT
Those three sets of positions already exist:
    Form.Location and Form.Size contain the visible bounds
    Form.AutoScrollPosition.X and Form.AutoScrollPosition.Y indicate the
virtual area offset
    Control.Position indicate where the control is.  I could've made it
work by adding the AutoScrollPosition.X & Y to the control position to
move them every time scrolling occurred.  I was expecting some type of
native method to accomplish the same (by docking the control to the
form.position).  You're suggestion is easier than capturing scrollbar
events, so I'll go with that.

> That would require that the control would be excluded from the normal
> positioning of child controls and instead be placed outside the actual
[quoted text clipped - 18 lines]
>>>> do I keep that from happening?  (Do I have to set the location of
>>>> the menu with each scroll-bar move???).
Gabriele G. Ponti - 13 Jun 2006 14:57 GMT
Instead of using the AutoScroll property of the form, dock a MenuStrip on
the top of your form and add a Panel docked to fill the remaining portion of
the form.

Set the AutoScroll property of the Panel control to True, and add your
controls to this panel.

   Gabriele

>I have a main form with autoscroll and a menu docked top & left.  When I
>scroll to the right or down, the menu moves off-screen.  How do I keep that
>from happening?  (Do I have to set the location of the menu with each
>scroll-bar move???).

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.