FlowLayoutPanel.WrapContents Property

Definition

Gets or sets a value indicating whether the FlowLayoutPanel control should wrap its contents or let the contents be clipped.

public:
 property bool WrapContents { bool get(); void set(bool value); };
public bool WrapContents { get; set; }
member this.WrapContents : bool with get, set
Public Property WrapContents As Boolean

Property Value

true if the contents should be wrapped; otherwise, false. The default is true.

Examples

The following code example sets the value of the WrapContents property depending on the Checked value of a CheckBox control.

private:
    void wrapContentsCheckBox_CheckedChanged(
        System::Object^ sender, System::EventArgs^ e)
    {
        this->flowLayoutPanel1->WrapContents =
            this->wrapContentsCheckBox->Checked;
    }
private void wrapContentsCheckBox_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.FlowLayoutPanel1.WrapContents = 
        this.wrapContentsCheckBox.Checked;
}
Private Sub wrapContentsCheckBox_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles wrapContentsCheckBox.CheckedChanged

    Me.FlowLayoutPanel1.WrapContents = Me.wrapContentsCheckBox.Checked

End Sub

Remarks

If the area of the panel is too small to contain all its child controls, at least one child control will be clipped regardless of the wrapping mode.

Subsequent resizing of the panel will reapply the layout to the contained controls.

Applies to

See also