TableLayoutPanel.RowStyles Özellik

Tanım

için TableLayoutPanelsatır stilleri koleksiyonunu alır.

public:
 property System::Windows::Forms::TableLayoutRowStyleCollection ^ RowStyles { System::Windows::Forms::TableLayoutRowStyleCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.TableLayoutRowStyleCollection RowStyles { get; }
[<System.ComponentModel.Browsable(false)>]
member this.RowStyles : System.Windows.Forms.TableLayoutRowStyleCollection
Public ReadOnly Property RowStyles As TableLayoutRowStyleCollection

Özellik Değeri

TableLayoutRowStyleCollection

TableLayoutRowStyleCollection Denetimdeki TableLayoutPanel her satır için bir RowStyle içeren.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, tıklandığında Button her satırın özelliklerini ayarlarRowStyle.

private void toggleRowStylesBtn_Click(
    System.Object sender, 
    System.EventArgs e)
{
    TableLayoutRowStyleCollection styles = 
        this.TableLayoutPanel1.RowStyles;

    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;
        }
        else
        {

            // 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 = _
    Me.TableLayoutPanel1.RowStyles

    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

        Else

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

        End If

    Next

End Sub

Açıklamalar

Belirli satırların RowStyles stil özelliklerine erişmek için özelliğini kullanın. Tablodaki tek tek satırların RowStyle özelliklerini ayarlamak için sınıfın üyelerini kullanabilirsiniz.

TableLayoutPanel Denetim satırlarını düzenlediğinde, her RowStyle birine aşağıdaki sırayla öncelikleri atar:

  1. RowStyle olarak ayarlanmış Absolute satırlar önce kabul edilir ve sabit yükseklikleri ayrılır.

  2. RowStyle olarak ayarlanmış AutoSize satırlar, içeriklerine göre boyutlandırılır.

  3. Kalan alan olarak ayarlanmış Percentsatırlar RowStyle arasında bölünür.

Şunlara uygulanır

Ayrıca bkz.