共用方式為


How to: Set Stretching Report Controls

You can specify that controls on reports and labels stretch, or automatically expand and contract to accommodate the output they generate. For example, a Field control that contains a memo field expression may evaluate to varying amounts of text from record to record. Therefore, you can set the control to stretch according to the amount of information it contains. If you are using a shape as a border around one or more field expression controls, you can also specify that the shape stretches to accommodate the varying size of the controls it encompasses.

Controls that can stretch might affect the position of other controls that appear below them in the layout. You can set the other controls to float, or adjust position automatically according to changes in size of the controls above them. For more information about adjusting report control position automatically, see How to: Adjust Report Control Position.

The following illustration shows how stretching and floating report controls function.

ControlSetExamples graphic

The following sections contain information about working with stretching controls:

  • Specifying Stretching for Report Controls

  • Displaying Borders for Stretchable Controls

Specifying Stretching for Report Controls

The following control types can be set to stretch:

  • Field/Expression

  • Vertical line

  • Rectangle / Rounded rectangle

For Line, Rectangle, and Rounded Rectangle controls, you can specify that they stretch relative to the height of the band that contains them or, if grouped, relative to the largest control in the group.

Warning

You must set floating for controls that are placed underneath controls that stretch; otherwise, the output generated from controls that stretch might overlap output in controls appearing underneath them. Output from controls might also be overwritten on the page layout when any of the following conditions occur:

  • You position a control that remains fixed relative to the bottom of the band and position a stretching control below it that remains fixed relative to the top of the band.

  • You position a control that remains fixed relative to the top of the band and position a stretching control above it that remains fixed to the top of the band.

To specify stretching for a report control

  1. Open the report or label in the appropriate designer.

  2. In the designer, double-click the report control you want.

    The properties dialog box for the report control opens.

    Note

    If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the report control dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable.

  3. In the report control properties dialog box, click the General tab if it is not selected.

  4. On the General tab, choose one of the following:

    • For Field controls, click Stretch with overflow.

    • For Rectangle, Rounded Rectangle, or vertical Line controls, in the Stretch downwards area, click the stretch setting you want.

For more information, see General Tab, Report Control Properties Dialog Box (Report Builder).

For examples, see the sample report Wrapping.frx in the Visual FoxPro ...\Samples\Solution\Reports directory.

To position a stretching report control below another

  1. Open the report or label in the appropriate designer.

  2. In the designer, position one report control below the other.

  3. Double-click the report control that appears above the other control.

    The properties dialog box for the report control opens.

    Note

    If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the report control dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable.

  4. In the report control properties dialog box, click the General tab if it is not selected.

  5. In the Object position area, click Fix relative to top of band, and then OK.

  6. Double-click the report control that appears below the other control.

    The properties dialog box for the report control opens.

  7. In the report control properties dialog box, click the General tab if it is not selected.

  8. In the Object position area on the General tab, click Float, and then OK.

For more information, see General Tab, Report Control Properties Dialog Box (Report Builder).

Displaying Borders for Stretchable Controls

You can use a shape control as a border around a report control, and specify that it stretches with the control.

To display a border for a stretching control

  1. Open the report or label in the appropriate designer.

  2. In the designer, draw a border by dragging a Rectangle or Rounded Rectangle report control around the report control that stretches.

  3. Double-click the Rectangle or Rounded Rectangle report control.

    The Rectangle Properties dialog box for the report control opens.

    Note

    If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the Rectangle/Line or Round Rectangle dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable, Rectangle/Line Dialog Box, and Round Rectangle Dialog Box.

  4. In the Rectangle Properties dialog box, click the General tab if it is not selected.

  5. In the Stretch downwards area, click Stretch relative to tallest object in group, and then OK.

  6. Drag a selection box around the Rectangle or Rounded Rectangle control.

  7. On the Format menu, click Group.

You can now manipulate both controls permanently as a single unit. The Rectangle or Rounded Rectangle control stretches when the report control within its boundaries stretches.

For more information, see How to: Add Shapes to Reports and How to: Group Report Controls.

See Also

Tasks

How to: Resize Report Controls

Other Resources

Configuring Report Controls