New Layout Mechanism in Whidbey.

Whidbey provides a rich Layout Mechanism. This is provided by two new containers, namely, the TableLayoutPanel and the FlowLayoutPanel. Also almost every control now provides a “AutoSize” property which allows the control to dynamically grow depending on the Text (which is very helpful for localised forms). There's another property called “ AutoRelocate” which will cause the controls to “Bump” if the Autosized control grew in size during layout.

The Layout Engine tries to layout the “Form” and each of its controls in a Layout Transaction. It asks the individual control its PreferredSize and lays it out accordingly. The LayoutEngine is then responsible for the “relocate” of other controls. But if you have set the SIZE of the control to non preferredSize then the control doesnt change its size and is skipped during autoRelocate. This may cause overlap of controls during Layout.

So if you would want all your controls to AutoSize and Relocate then its necessary to set both “AutoSize” and “AutoRelocate” to true for all the controls.

More info on Layout Feature here.

Comments

  • Anonymous
    July 03, 2004
    Is there more detailed information on LayoutEngine and Layout Transaction anywhere? I am particularly interested in how layout is both "pluggable" and easily edited in the designer, and the layout algorithm. Are per-control layout properties made visible or set at a higher level, by an IExtenderProvider?