TableLayoutColumnStyleCollection 類別

定義

儲存 ColumnStyle 物件的集合。

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

範例

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

private void toggleColumnStylesBtn_Click(
    System.Object sender, 
    System.EventArgs e)
{
    TableLayoutColumnStyleCollection styles = 
        this.TableLayoutPanel1.ColumnStyles;

    foreach( ColumnStyle style in styles )
    {
        if( style.SizeType == SizeType.Absolute )
        {
            style.SizeType = SizeType.AutoSize;
        }
        else if( style.SizeType == SizeType.AutoSize )
        {
            style.SizeType = SizeType.Percent;

            // Set the column width to be a percentage
            // of the TableLayoutPanel control's width.
            style.Width = 33;
        }
        else
        {
            // Set the column width to 50 pixels.
            style.SizeType = SizeType.Absolute;
            style.Width = 50;
        }
    }
}
Private Sub toggleColumnStylesBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles toggleColumnStylesBtn.Click

    Dim styles As TableLayoutColumnStyleCollection = _
    Me.TableLayoutPanel1.ColumnStyles

    For Each style As ColumnStyle In styles

        If style.SizeType = SizeType.Absolute Then

            style.SizeType = SizeType.AutoSize

        ElseIf style.SizeType = SizeType.AutoSize Then

            style.SizeType = SizeType.Percent

            ' Set the column width to be a percentage
            ' of the TableLayoutPanel control's width.
            style.Width = 33

        Else

            ' Set the column width to 50 pixels.
            style.SizeType = SizeType.Absolute
            style.Width = 50

        End If

    Next

End Sub

備註

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

屬性

Count

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

(繼承來源 TableLayoutStyleCollection)
Item[Int32]

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

方法

Add(ColumnStyle)

將項目加入至 TableLayoutColumnStyleCollection

Add(TableLayoutStyle)

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

(繼承來源 TableLayoutStyleCollection)
Clear()

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

(繼承來源 TableLayoutStyleCollection)
Contains(ColumnStyle)

判斷集合中是否有指定的 ColumnStyle

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(ColumnStyle)

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

Insert(Int32, ColumnStyle)

在指定位置將 ColumnStyle 插入 TableLayoutColumnStyleCollection

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(ColumnStyle)

移除 ColumnStyle 中,特定 TableLayoutColumnStyleCollection 的第一個項目。

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

適用於

另請參閱