|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Toolbar Scrolls with WindowI 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???). 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. bern11 wrote: Show quote > 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???). 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.... Göran Andersson wrote: Show quote > 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. > > bern11 wrote: > >> 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???). 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. :) bern11 wrote: Show quote > 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.... > > > Göran Andersson wrote: >> 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. >> >> bern11 wrote: >> >>> 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???). 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. Göran Andersson wrote: Show quote > 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. :) > > bern11 wrote: > >> 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.... >> >> >> Göran Andersson wrote: >> >>> 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. >>> >>> bern11 wrote: >>> >>>> 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???). 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 Show quote "bern11" <ber***@yahoo.com> wrote in message news:RLKdnWQs6_D1uxPZnZ2dnUVZ_t2dnZ2d@comcast.com... >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???). |
|||||||||||||||||||||||