TableLayoutPanelGrowStyle Enumeração

Definição

Especifica como um TableLayoutPanel obterá linhas ou colunas adicionais depois que suas células existentes estiverem cheias.

public enum class TableLayoutPanelGrowStyle
public enum TableLayoutPanelGrowStyle
type TableLayoutPanelGrowStyle = 
Public Enum TableLayoutPanelGrowStyle
Herança
TableLayoutPanelGrowStyle

Campos

AddColumns 2

O TableLayoutPanel obtém colunas adicionais depois que estiver cheio.

AddRows 1

O TableLayoutPanel obtém linhas adicionais depois que estiver cheio.

FixedSize 0

O TableLayoutPanel não permite linhas nem colunas adicionais depois que estiver cheio.

Exemplos

O exemplo a seguir mostra como usar TableLayoutPanelGrowStyle para definir a TableLayoutPanel.GrowStyle propriedade. Este exemplo faz parte de um exemplo maior fornecido para o TableLayoutPanel controle.

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

Comentários

Se todas as células no local TableLayoutPanel forem preenchidas e a GrowStyle propriedade estiver definida como FixedSize, uma tentativa de adicionar outro controle gerará uma exceção.

Aplica-se a

Confira também