Docking and overlappping onrols

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I had placed three controls on a UserControl and had them all perfectly
docked together filling up the UserControl.

I needed to add a fourth controls docked to the top. So I dropped it on the
UserControl, changed the new control to Dock = top and changed the taborder
of all the other controls (bumped each up by 1) . But when I start changing
the other controls back to dock = left, fill, etc... they expand the entire
height of the form making the top controls appear to overlap all the other
controls . In a sense, the controls "slip" under the new 4th control.


If I were to remove them all and place new controls from scratch they all
appear fine and respect the control with the "Top" boundary - then it works
fine. But I would have to redo alot of settings if I took this route!!!

How can I make sure that any newly added controls dock appropriately with
the previous controls

Thanks
 
I think I had a similar problem before - and it has something to do with the
order of the controls being added to a container.

In the "Windows Form Designer genereted code" locate the lines where the
controls in questions are added to the container, something similar to the

Me.Controls.Add(Me.myNewlyAddedControl) in VB, or
this.Controls.Add(this.myNewlyAddedControl) in C#.

Then move this line of code prior to the other docked controls and switch to
design view - now your controls should appear as you wanted them to..

As far as I understand TabIndex has nothing to do with that, though it is
always good to set it right.

HTH
 
I think that I had it wrong - instead of moving the line of the
NewelyAddedControl up - move it down - that should do it
 
Try selecting the controls that are "under" the 4th control and
choosing "Bring To Front" for that control. You can also experiment
with this on the other controls until you get them the way you want.
 
Back
Top