I am using Visual Studio 2005 Professional Edition Version 8.0.50727.42. In a PocketPC2003 project, I am having trouble seting up one of my forms. The first thing I did is create a panel and dock it to the top. Then I created a label and a few check boxes and put them inside the panel. I docked the label to the top of the panel. below the first panel I have a splitter, also with its' dock property set to top. This positions it just below the first panel. Then, below the splitter, I have another panel with its' dock property set to fill. This causes it to fill up the remaing portion of the form. So far everything is working fine. Then inside the second panel, I placed a label and docked it to the top of that panel. Also inside the second panel I have a tree view docked to fill the rest of the panel, but this does not work how it should. Instead of filling the remaining portion of the panel(the part not occupied by the label), it fills the whole panel, with the lable covering up the top of it. I checked the Designer.cs for that form to see if everything was set how it should be, and it was. Is this a bug or am I doing something wrong Any help will be appreciated.

problem with dock fill
vchu
Scottzrn
Therefore, to add a component on the "inside" of the container, with the older, docked component toward the outside, you need to add the newer component at the front of the Controls set, instead of at the end. Unfortunately, there is no Controls.Insert() function; only a Controls.Add().
Therefore, to add a new panel and dock it fill with other panels already docked, do this:
Controls.Add(panel);
Controls.SetChildIndex(panel,0);
panel.DockStyle=DockStyle.Fill.
Mike Rorke - MSFT
Somehow it seems that in one of the applications I made, the order in which I put the controls in the form has great effect.
On a form with a left panel, a splitter and a right (fill) panel, I have to add the fill first or it will capture the entire area (as described in the first post). I must add the splitter before the left panel, or otherwise it will end up on the left of the left panel.
On the left form, there's a top panel, a bottom panel and a (fill) listview. I have to add the listview first, or it will, again, capture the whole client area of the parent panel. The other two don't influence each other's position, so I can add them in any order I want.
This behaviour seems a bit picky though..
B-M-C
yes, you are correct, the order of controls makes all the difference in docking/anchoring. The designer changes that order via SendToBack and BringToFront. If you don't have the luxury of using the designer you'll need to do the equivalent manually in code.
That said, our docs can probably use some brushing up on this point. I will be forwarding this thread to our doc writer.
Andrew K Lee
Artie Sluka
this.Controls.Add(this.dgResults);
this.Controls.Add(this.tbrMain);
this.Controls.Add(this.spltHorizontal);
this.Controls.Add(this.txtOutput);