TableLayoutPanelGrowStyle TableLayoutPanelGrowStyle TableLayoutPanelGrowStyle TableLayoutPanelGrowStyle Enum

定義

既存のセルがいっぱいになった後、TableLayoutPanel が追加の行または列を取得する方法を指定します。Specifies how a TableLayoutPanel will gain additional rows or columns after its existing cells are full.

public enum class TableLayoutPanelGrowStyle
public enum TableLayoutPanelGrowStyle
type TableLayoutPanelGrowStyle = 
Public Enum TableLayoutPanelGrowStyle
継承
TableLayoutPanelGrowStyleTableLayoutPanelGrowStyleTableLayoutPanelGrowStyleTableLayoutPanelGrowStyle

フィールド

AddColumns AddColumns AddColumns AddColumns 2

TableLayoutPanel は、いっぱいになった後、追加列を取得します。The TableLayoutPanel gains additional columns after it is full.

AddRows AddRows AddRows AddRows 1

TableLayoutPanel は、いっぱいになった後、追加行を取得します。The TableLayoutPanel gains additional rows after it is full.

FixedSize FixedSize FixedSize FixedSize 0

TableLayoutPanel は、いっぱいになった後、行または列の追加を許可しません。The TableLayoutPanel does not allow additional rows or columns after it is full.

次の例は、使用する方法を示しますFixedSizeを設定する、GrowStyleプロパティをGrowStyleコントロール。The following example shows how to use FixedSize to set the GrowStyle property on a GrowStyle control. このコード例が示されている例の一部、TableLayoutPanelコントロール。This code example is part of a larger example provided for the TableLayoutPanel control.

  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がいっぱいになると、 GrowStyle FixedSize に設定されて、別のコントロールを追加しようとすると、例外がスローされます。If all the cells in the TableLayoutPanel are filled and the GrowStyle property is set to FixedSize, an attempt to add another control will throw an exception.

適用対象

こちらもご覧ください