TableLayoutPanel.RowStyles TableLayoutPanel.RowStyles TableLayoutPanel.RowStyles TableLayoutPanel.RowStyles Property


行のスタイルのコレクションを取得、TableLayoutPanelします。Gets a collection of row styles for the TableLayoutPanel.

 property System::Windows::Forms::TableLayoutRowStyleCollection ^ RowStyles { System::Windows::Forms::TableLayoutRowStyleCollection ^ get(); };
public System.Windows.Forms.TableLayoutRowStyleCollection RowStyles { get; }
member this.RowStyles : System.Windows.Forms.TableLayoutRowStyleCollection
Public ReadOnly Property RowStyles As TableLayoutRowStyleCollection


次のコード例のセット、RowStyle行の各プロパティをButtonをクリックします。The following code example sets the RowStyle properties of each row when a Button is clicked.

  private void toggleRowStylesBtn_Click(
System.Object sender, 
System.EventArgs e)
TableLayoutRowStyleCollection styles = 

      foreach( RowStyle style in styles )
          if (style.SizeType==SizeType.Absolute)
              style.SizeType = SizeType.AutoSize;
          else if(style.SizeType==SizeType.AutoSize)
              style.SizeType = SizeType.Percent;

              // Set the row height to be a percentage
              // of the TableLayoutPanel control's height.
              style.Height = 33;

              // Set the row height to 50 pixels.
              style.SizeType = SizeType.Absolute;
              style.Height = 50;
Private Sub toggleRowStylesBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles toggleRowStylesBtn.Click

    Dim styles As TableLayoutRowStyleCollection = _

    For Each style As RowStyle In styles

        If style.SizeType = SizeType.Absolute Then

            style.SizeType = SizeType.AutoSize

        ElseIf style.SizeType = SizeType.AutoSize Then

            style.SizeType = SizeType.Percent

            ' Set the row height to be a percentage
            ' of the TableLayoutPanel control's height.
            style.Height = 33


            ' Set the row height to 50 pixels.
            style.SizeType = SizeType.Absolute
            style.Height = 50

        End If


End Sub


使用して、RowStyles特定の行のスタイル プロパティにアクセスするプロパティ。Use the RowStyles property to access the style properties of specific rows. メンバーを使用することができます、RowStyle表内の個々 の行の特性を設定するクラス。You can use members of the RowStyle class to set the characteristics of individual rows in the table.

ときに、TableLayoutPanelコントロールがその行を配置、それぞれに優先順位を割り当てますRowStyle次の順序で。When the TableLayoutPanel control arranges its rows, it assigns priorities to each RowStyle in the following order:

  1. RowStyle設定Absoluteは最初、および、固定の高さが割り当てられていると見なされます。Rows with RowStyle set to Absolute are considered first, and their fixed heights are allocated.

  2. RowStyle設定AutoSizeサイズをその内容。Rows with RowStyle set to AutoSize are sized to their contents.

  3. 持つ行に分割されている残りの領域RowStyle設定Percentします。Remaining space is divided among rows with RowStyle set to Percent.