Anchoring/overlaying control issue

  • Thread starter Thread starter proxyuser
  • Start date Start date
P

proxyuser

VS 2008, C#, .NET 3.5.

I'm maintaining code - a form that has numerous controls, including a text
box on the left side and a check box on the right side. The text box is
anchored Top/Left, and the check box is anchored Top/Right. When the form
is sized down (narrowed left to right), the text box moves to the right.
Eventually it encroaches on the check box and overlays it (there are also
some buttons above the check box on the right hand side.) As I continuing
shrinking the form, the text box stops moving to the right and a scroll bar
shows up at the bottom.

I'm not sure what's triggering the scroll bar to show up, nor why it
overlays the check box a little, and then stops. Basically I'd want the
scroll bars to show up and the text box to stop encroaching on the check box
just before it starts to overlap it. Any help? thx
 
Anchoring works simply by keeping distance from specified edges fixed. So,
there is a size of form, for which distance from specified edge forces it to
overlap. If you really want to have professional layout management, you need
a good layout manager e.g.
SmartLayouts | http://www.smart-components.com/
 
Hi,
I'm maintaining code - a form that has numerous controls, including a text
box on the left side and a check box on the right side. The text box is
anchored Top/Left, and the check box is anchored Top/Right. When the form
is sized down (narrowed left to right), the text box moves to the right.
Eventually it encroaches on the check box and overlays it (there are also
some buttons above the check box on the right hand side.) As I continuing
shrinking the form, the text box stops moving to the right and a scroll bar
shows up at the bottom.

I'm not sure what's triggering the scroll bar to show up, nor why it
overlays the check box a little, and then stops. Basically I'd want the
scroll bars to show up and the text box to stop encroaching on the check box
just before it starts to overlap it. Any help? thx

wouldn't setting the MinimumSize-property to an appropriate value of the
form be a better approach ..?
As to the problem itself, there must be some other control that itself will
cause the form to show the scrollbars as it cannot be shown completely.
That is, resizing the form alone will not cause the scrollbars to appear,
they will only be shown if you set the form's AutoScroll property and then
only as soon as the first control does not fit into the the client region
(!) anymore. If you anchor a control to i.e. the top right so that it
overlaps another one when reducing the form's size, this won't trigger the
scrollbars as long as it can still be shown completely. Both the anchored
control as well as the control that is being overlapped by the other one
will only trigger the scrollbars as soon as one of them doesn't completely
fit into the form's canvas anymore.

Cheers,
Olaf
 
Back
Top