TableLayoutRowStyleCollection 類別

定義

儲存 RowStyle 物件的集合。

public ref class TableLayoutRowStyleCollection : System::Windows::Forms::TableLayoutStyleCollection
public class TableLayoutRowStyleCollection : System.Windows.Forms.TableLayoutStyleCollection
type TableLayoutRowStyleCollection = class
    inherit TableLayoutStyleCollection
Public Class TableLayoutRowStyleCollection
Inherits TableLayoutStyleCollection
繼承
TableLayoutRowStyleCollection

範例

下列範例示範如何為 TableLayoutRowStyleCollection 設定 RowStyle 。 此程式碼範例是提供給 控制項之較大範例的 TableLayoutPanel 一部分。

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

備註

類別 TableLayoutRowStyleCollection 代表用來描述相關聯 TableLayoutPanel 中資料列之所有樣式的集合。

屬性

Count

取得實際包含在 TableLayoutStyleCollection 中的樣式數目。

(繼承來源 TableLayoutStyleCollection)
Item[Int32]

取得或設定在指定索引處的 RowStyle

方法

Add(RowStyle)

將新的 RowStyle 加入至 TableLayoutRowStyleCollection

Add(TableLayoutStyle)

將新的 TableLayoutStyle 加入至目前集合的結尾。

(繼承來源 TableLayoutStyleCollection)
Clear()

解除集合與其關聯的 TableLayoutPanel 之間的關聯性,然後清空此集合。

(繼承來源 TableLayoutStyleCollection)
Contains(RowStyle)

判斷 TableLayoutRowStyleCollection 是否包含特定的樣式。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(RowStyle)

判斷 TableLayoutRowStyleCollection 中指定項目的索引。

Insert(Int32, RowStyle)

在指定位置將 RowStyle 插入 TableLayoutRowStyleCollection

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(RowStyle)

TableLayoutRowStyleCollection 移除特定物件之第一個符合的元素。

RemoveAt(Int32)

移除集合中指定索引上的樣式。

(繼承來源 TableLayoutStyleCollection)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

如需這個方法的描述,請參閱 CopyTo(Array, Int32) 方法。

(繼承來源 TableLayoutStyleCollection)
ICollection.IsSynchronized

如需這個方法的描述,請參閱 IsSynchronized 屬性。

(繼承來源 TableLayoutStyleCollection)
ICollection.SyncRoot

如需這個方法的描述,請參閱 SyncRoot 屬性。

(繼承來源 TableLayoutStyleCollection)
IEnumerable.GetEnumerator()

如需這個方法的描述,請參閱 GetEnumerator() 方法。

(繼承來源 TableLayoutStyleCollection)
IList.Add(Object)

如需這個方法的描述,請參閱 Add(Object) 方法。

(繼承來源 TableLayoutStyleCollection)
IList.Contains(Object)

如需這個方法的描述,請參閱 Contains(Object) 方法。

(繼承來源 TableLayoutStyleCollection)
IList.IndexOf(Object)

如需這個方法的描述,請參閱 IndexOf(Object) 方法。

(繼承來源 TableLayoutStyleCollection)
IList.Insert(Int32, Object)

如需這個方法的描述,請參閱 Insert(Int32, Object) 方法。

(繼承來源 TableLayoutStyleCollection)
IList.IsFixedSize

如需這個方法的描述,請參閱 IsFixedSize 屬性。

(繼承來源 TableLayoutStyleCollection)
IList.IsReadOnly

如需這個方法的描述,請參閱 IsReadOnly 屬性。

(繼承來源 TableLayoutStyleCollection)
IList.Item[Int32]

如需這個方法的描述,請參閱 Item[Int32] 屬性。

(繼承來源 TableLayoutStyleCollection)
IList.Remove(Object)

如需這個方法的描述,請參閱 Remove(Object) 方法。

(繼承來源 TableLayoutStyleCollection)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱