« XML, Embedding HTML in XML | Main | OnResized, OnSizeChanged, OnLayout »

Window Forms, Control Layout, Docking Padding

Tricks to effective layout using docking:

1.       Use “Docking Padding” property of panels and group boxes to inset docked controls.

2.       Individual controls will dock against the next most front control. Check that the control you’re about to dock is in front by dragging it so that it partially covers the controls it is meant to dock against.

3.       Splitters are only needed if user adjustments of control (panels generally) is needed.

4.       Haven’t found a way yet to set splitter behavior to a percentage of available space.

5.       If you lose a control behind other controls, find it in the combo box at the top of the properties window.

6.       “6” works well as an “All” Docking Padding setting.

7.       Splitter width is adjustable. Its either the X or Y size depending on how the splitter is docked.

8.       When you add controls thru the designer, they appear in an AddRange method call as an array in the inverse order of creation. When you add controls one at a time with the Add method, immediately call BringToFront on the just added control to force them into creation order. Alternatively, you can add them backwards in “designer” time. Logically this means you’d first add the control with fill docking and then add the controls working from the center to the edges.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)