Compartir a través de


TableLayoutPanel Control Sample

Demonstrates how to use a TableLayoutPanel control to create layouts that can be easily resized.

This sample provides a set of forms that use the TableLayoutPanel control to implement layouts for data entry.

For information about using the samples, see the following topics:

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build and run the sample using the command prompt

  1. At the command prompt, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the TableLayoutPanelSample directory.

  3. Type msbuild to build the sample using the solution (.sln) file provided.

  4. Type cd TableLayoutPanelSample\bin\Debug to navigate to the location of the executable file.

  5. Type TableLayoutPanelSample.exe to run the sample.

To build and run the sample using Visual Studio

  1. In Windows Explorer, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the TableLayoutPanelSample directory.

  3. Double-click the solution (.sln) file to open it in Visual Studio.

  4. In Visual Studio, press F5 to build and run the sample.

To use the TableLayoutPanelSample

  1. In the Form to View ComboBox control, select the form you want to view. The Form Description field describes the different forms.

  2. Click the View Form button to start the selected form.

Demonstrates

  • Proportional resizing of a layout with two main panes, and two button controls at fixed positions within a central column.

  • A simple data entry form, using the TableLayoutPanel control to yield simple but robust resizing behavior. A single TableLayoutPanel control encompasses all controls except for the two buttons at the bottom of the form.

See Also

Tasks

How to: Design a Windows Forms Layout that Responds Well to Localization
How to: Create a Resizable Windows Form for Data Entry

Reference

FlowLayoutPanel
TableLayoutSettings