TableLayoutPanel.GrowStyle TableLayoutPanel.GrowStyle TableLayoutPanel.GrowStyle TableLayoutPanel.GrowStyle Property

정의

모든 기존 셀이 꽉 찼을 때 새 셀을 수용하도록 TableLayoutPanel 컨트롤을 확장할지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the TableLayoutPanel control should expand to accommodate new cells when all existing cells are occupied.

public:
 property System::Windows::Forms::TableLayoutPanelGrowStyle GrowStyle { System::Windows::Forms::TableLayoutPanelGrowStyle get(); void set(System::Windows::Forms::TableLayoutPanelGrowStyle value); };
public System.Windows.Forms.TableLayoutPanelGrowStyle GrowStyle { get; set; }
member this.GrowStyle : System.Windows.Forms.TableLayoutPanelGrowStyle with get, set
Public Property GrowStyle As TableLayoutPanelGrowStyle

속성 값

확장 체계를 나타내는 TableLayoutPanelGrowStyle입니다.A TableLayoutPanelGrowStyle indicating the growth scheme. 기본값은 AddRows입니다.The default is AddRows.

예외

TableLayoutPanelGrowStyle 열거형에 대해 속성 값이 잘못된 경우The property value is invalid for the TableLayoutPanelGrowStyle enumeration.

예제

다음 코드 예제에서는 값을 설정 합니다 GrowStyle 속성에 따라 선택한 RadioButton합니다.The following code example sets the value of the GrowStyle property depending on the selected RadioButton. 런타임 시 사용자 라는 레이블이 지정 된 단추를 클릭할 때 GrowStyle 테스트, Button 컨트롤이 추가 되는 TableLayoutPanel 제어 합니다.At run time, when the user clicks on the button labeled Test GrowStyle, a Button control is added to the TableLayoutPanel control. 경우는 TableLayoutPanel 제어 가득, 행 또는 열을 추가 하 여 확장 또는 값에 따라 예외를 발생 시킵니다 GrowStyle합니다.If the TableLayoutPanel control is full, it expands by adding a row or column, or it raises an exception, depending on the value of GrowStyle.

private void growStyleNoneBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.tlpGrowStyle = TableLayoutPanelGrowStyle.FixedSize;
}

private void growStyleAddRowBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddRows;
}

private void growStyleAddColumnBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddColumns;
}

private void testGrowStyleBtn_Click(
    System.Object sender, 
    System.EventArgs e)
{
    this.TableLayoutPanel1.GrowStyle = this.tlpGrowStyle;

    try
    {
        this.TableLayoutPanel1.Controls.Add(new Button());
    }
    catch(ArgumentException ex)
    {
        Trace.WriteLine(ex.Message);
    }
}
Private Sub growStyleNoneBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleNoneBtn.CheckedChanged

    Me.tlpGrowStyle = TableLayoutPanelGrowStyle.FixedSize

End Sub

Private Sub growStyleAddRowBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleAddRowBtn.CheckedChanged

    Me.tlpGrowStyle = TableLayoutPanelGrowStyle.AddRows

End Sub

Private Sub growStyleAddColumnBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleAddColumnBtn.CheckedChanged

    Me.tlpGrowStyle = TableLayoutPanelGrowStyle.AddColumns

End Sub

Private Sub testGrowStyleBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles testGrowStyleBtn.Click

    Me.TableLayoutPanel1.GrowStyle = Me.tlpGrowStyle

    Try

        Me.TableLayoutPanel1.Controls.Add(New Button())

    Catch ex As ArgumentException

        Trace.WriteLine(ex.Message)

    End Try

End Sub

설명

기본적으로 TableLayoutPanel 컨트롤은 행을 추가하여 아래로 확장됩니다.By default, the TableLayoutPanel control expands downward by adding rows.

참고

전체 컨트롤을 추가 하려면 시도가 이루어집니다 TableLayoutPanel 컨트롤과 값 GrowStyle 됩니다 FixedSizeArgumentException throw 됩니다.If an attempt is made to add a control to a full TableLayoutPanel control, and the value of GrowStyle is FixedSize, then an ArgumentException is thrown.

적용 대상

추가 정보