TableLayoutRowStyleCollection TableLayoutRowStyleCollection TableLayoutRowStyleCollection TableLayoutRowStyleCollection Class

定义

一个存储 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
继承
TableLayoutRowStyleCollectionTableLayoutRowStyleCollectionTableLayoutRowStyleCollectionTableLayoutRowStyleCollection

示例

下面的示例演示如何设置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

注解

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

属性

Count Count Count Count

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

(Inherited from TableLayoutStyleCollection)
ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

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

(Inherited from TableLayoutStyleCollection)
ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

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

(Inherited from TableLayoutStyleCollection)
IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

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

(Inherited from TableLayoutStyleCollection)
IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

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

(Inherited from TableLayoutStyleCollection)
IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

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

(Inherited from TableLayoutStyleCollection)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

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

方法

Add(RowStyle) Add(RowStyle) Add(RowStyle) Add(RowStyle)

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

Add(TableLayoutStyle) Add(TableLayoutStyle) Add(TableLayoutStyle) Add(TableLayoutStyle)

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

(Inherited from TableLayoutStyleCollection)
Clear() Clear() Clear() Clear()

取消关联的集合及其关联的TableLayoutPanel并清空该集合。Disassociates the collection from its associated TableLayoutPanel and empties the collection.

(Inherited from TableLayoutStyleCollection)
Contains(RowStyle) Contains(RowStyle) Contains(RowStyle) Contains(RowStyle)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
IndexOf(RowStyle) IndexOf(RowStyle) IndexOf(RowStyle) IndexOf(RowStyle)

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

Insert(Int32, RowStyle) Insert(Int32, RowStyle) Insert(Int32, RowStyle) Insert(Int32, RowStyle)

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

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
Remove(RowStyle) Remove(RowStyle) Remove(RowStyle) Remove(RowStyle)

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

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

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

(Inherited from TableLayoutStyleCollection)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

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

(Inherited from TableLayoutStyleCollection)
IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

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

(Inherited from TableLayoutStyleCollection)
IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

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

(Inherited from TableLayoutStyleCollection)
IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

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

(Inherited from TableLayoutStyleCollection)
IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

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

(Inherited from TableLayoutStyleCollection)
IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

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

(Inherited from TableLayoutStyleCollection)
IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

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

(Inherited from TableLayoutStyleCollection)

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

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

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

将转换IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅