TableLayoutRowStyleCollection 类

定义

一个存储 RowStyle 对象的集合。A collection that stores RowStyle objects.

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

示例

下面的示例演示如何为设置RowStyleTableLayoutRowStyleCollectionThe following example shows how to set RowStyle for a TableLayoutRowStyleCollection. 此代码示例是为TableLayoutPanel控件提供的更大示例的一部分。This code example is part of a larger example provided for the TableLayoutPanel control.

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

注解

类表示用于描述关联TableLayoutPanel的中的行的所有样式的集合。 TableLayoutRowStyleCollectionThe TableLayoutRowStyleCollection class represents the collection of all the styles used to describe the rows in an associated TableLayoutPanel.

属性

Count

获取 TableLayoutStyleCollection 中实际包含的样式数量。Gets the number of styles actually contained in the TableLayoutStyleCollection.

(继承自 TableLayoutStyleCollection)
Item[Int32]

获取或设置指定索引处的 RowStyleGets or sets the RowStyle at the specified index.

方法

Add(RowStyle)

将新 RowStyle 添加到 TableLayoutRowStyleCollection 中。Adds a new RowStyle to the TableLayoutRowStyleCollection.

Add(TableLayoutStyle)

在当前集合的末尾添加一个新的 TableLayoutStyleAdds a new TableLayoutStyle to the end of the current collection.

(继承自 TableLayoutStyleCollection)
Clear()

断开集合与关联的 TableLayoutPanel 之间的关联,并清空该集合。Disassociates the collection from its associated TableLayoutPanel and empties the collection.

(继承自 TableLayoutStyleCollection)
Contains(RowStyle)

确定 TableLayoutRowStyleCollection 是否包含特定样式。Determines whether the TableLayoutRowStyleCollection contains a specific style.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
IndexOf(RowStyle)

确定 TableLayoutRowStyleCollection 中特定项的索引。Determines the index of a specific item in the TableLayoutRowStyleCollection.

Insert(Int32, RowStyle)

RowStyle 插入指定位置的 TableLayoutRowStyleCollectionInserts a RowStyle into the TableLayoutRowStyleCollection at the specified position.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Remove(RowStyle)

TableLayoutRowStyleCollection 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the TableLayoutRowStyleCollection.

RemoveAt(Int32)

移除集合的指定索引处的样式。Removes the style at the specified index of the collection.

(继承自 TableLayoutStyleCollection)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

ICollection.CopyTo(Array, Int32)

有关此方法的说明,请参见 CopyTo(Array, Int32) 方法。For a description of this method, see the CopyTo(Array, Int32) method.

(继承自 TableLayoutStyleCollection)
ICollection.IsSynchronized

有关此方法的说明,请参见 IsSynchronized 属性。For a description of this method, see the IsSynchronized property.

(继承自 TableLayoutStyleCollection)
ICollection.SyncRoot

有关此方法的说明,请参见 SyncRoot 属性。For a description of this method, see the SyncRoot property.

(继承自 TableLayoutStyleCollection)
IEnumerable.GetEnumerator()

有关此方法的说明,请参见 GetEnumerator() 方法。For a description of this method, see the GetEnumerator() method.

(继承自 TableLayoutStyleCollection)
IList.Add(Object)

有关此方法的说明,请参见 Add(Object) 方法。For a description of this method, see the Add(Object) method.

(继承自 TableLayoutStyleCollection)
IList.Contains(Object)

有关此方法的说明,请参见 Contains(Object) 方法。For a description of this method, see the Contains(Object) method.

(继承自 TableLayoutStyleCollection)
IList.IndexOf(Object)

有关此方法的说明,请参见 IndexOf(Object) 方法。For a description of this method, see the IndexOf(Object) method.

(继承自 TableLayoutStyleCollection)
IList.Insert(Int32, Object)

有关此方法的说明,请参见 Insert(Int32, Object) 方法。For a description of this method, see the Insert(Int32, Object) method.

(继承自 TableLayoutStyleCollection)
IList.IsFixedSize

有关此方法的说明,请参见 IsFixedSize 属性。For a description of this method, see the IsFixedSize property.

(继承自 TableLayoutStyleCollection)
IList.IsReadOnly

有关此方法的说明,请参见 IsReadOnly 属性。For a description of this method, see the IsReadOnly property.

(继承自 TableLayoutStyleCollection)
IList.Item[Int32]

有关此方法的说明,请参见 Item[Int32] 属性。For a description of this method, see the Item[Int32] property.

(继承自 TableLayoutStyleCollection)
IList.Remove(Object)

有关此方法的说明,请参见 Remove(Object) 方法。For a description of this method, see the Remove(Object) method.

(继承自 TableLayoutStyleCollection)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅