views:

381

answers:

5
+1  A: 

A control has two methods to achieve what you are looking for: SendToFront and SendToBack.

Gerrie Schenck
A: 

Go to View -> Other windows -> document outline.

In that window drag the controls so the docking is as you like it to be.

Stormenet
sorry, poor question. PROGRAMATICALLY.
Tommy
+1  A: 

The order in which the controls are being added to the Controls collection determines the docking order.

Best Regards,
Oliver Hanappi

Oliver Hanappi
I need to edit the docking order after the controls are added to the collection
Tommy
Then go for the `ControlCollection.SetChildIndex(control, index)` method.
Oliver Hanappi
+3  A: 

Use
myControl.SendToBack();
myControl.BringToFront();
methods.

serhio
I was looking for `control.SendToFront()` See, now that was easy. Thanks!
Tommy
A: 

As you said, the newest control to be add to the controls collection is the one on top. If you need newer control to be add at the bottom, I'll suggest to create a list of control, add the controls to the list, reverse the list and add the list to the controls collection.

List<Control> controls = new List<Control();
controls.Add(new myFirstControl());
controls.Add(new mySecondControl());
controls.Reverse();
this.Controls.AddRange(controls.ToArray());
Alexandre Pepin