Bagikan melalui


Portal-Style Flow Layout Sample

This sample demonstrates a simple portal-style layout that is implemented with a FlowLayoutPanel control.

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 PortalStyleFlowLayout directory.

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

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

  5. Type PortalStyleFlowLayout.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 PortalStyleFlowLayout 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 PortalStyleFlowLayout Sample

  1. Click the Add New Element button to insert a new PortalElement control. Repeat this step a few times to populate the FlowLayoutPanel control with several PortalElement controls.

  2. Resize the form and observe how the FlowLayoutPanel control changes the layout of the PortalElement controls.

  3. Click the Add Text button in one of the PortalElement controls. Repeat this step a few times to expand the PortalElement control. Notice how the layout changes.

  4. Repeat step 3 with other PortalElement controls. Notice how the layout changes.

  5. Click the Clear Text button in one of the PortalElement controls. Notice how the layout changes.

  6. Click the Delete This Element button in one of the PortalElement controls. Notice how the layout changes.

Demonstrates

  • How the FlowLayoutPanel control responds to changes in the size of its contents.

See Also

Reference

FlowLayoutPanel Control Overview

FlowLayoutPanel