If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab
If you don't want to change the order of the elements inside the code, you can use the method Container.Controls.SetChildIndex() with Container being the e.g. Form, Panel etc. you want do add your controls to.
Example:
//Container ------------------------------------
Panel Container = new Panel();
//Top-Docked Element ---------------------------
ButtonArea = new FlowLayoutPanel();
Container.Controls.Add(ButtonArea);
Container.Controls.SetChildIndex(ButtonArea, 1);
ButtonArea.Dock = DockStyle.Top;
//Fill-Docked Element --------------------------
box = new RichTextBox();
Container.Controls.Add(box);
Container.Controls.SetChildIndex(box, 0); //setting this to 0 does the trick
box.Dock = DockStyle.Fill;