AutoLayout by Examples
Author: Tan Phan
Creation. Many of the tricks and tips shown in this document come from
- To provide many examples on how the Windows Forms TableLayoutPanel can be used in various capacities to create simple as well as complex dialog layouts
- To demonstrate auto-layout tricks and tips for effective and rapid dialog creation
- Visual Studio 2005
- Some working knowledge of Windows Forms and the Visual Studio 2005 Form Designer
- Able to load the solution AutoLayoutByExamples.sln (included as an attachment in the series' first post) and run the projects. Download source.
- The Document Outline can be used to select nested containers that maybe difficult to select through the designer otherwise. To open the Document Outline, do View > Other Windows > Document Outline. To select a control in the form, highlight the corresponding item in the document outline.
- To select controls that are hidden or occluded by other controls, right-click on the visible control in the designer to show the context menu. The context menu will contains all controls under the clicked XY location all the way up to the outer-most control or form. In the screen shot below, right-clicking on the OK button drops down the context menu which shows the options to select the panel containing the buttons, the “overarching” panel, and the form itself.
- Bring to Front and Send to Back can also be used to raise or lower sibling controls that overlap. This is especially useful when working with container panels that have exactly the same location and dimensions.
- When working with TableLayoutPanel, keep the empty rows at some absolute height until content has been added. Marking an empty row AutoSize will flatten the row in the designer and will make it difficult to drop content into it.
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included
script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm