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

範例

以下範例展示了如何設定 ColumnStyleTableLayoutColumnStyleCollection 此程式碼範例是控制項所提供 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欄位的樣式集合。

屬性

名稱 Description
Count

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

(繼承來源 TableLayoutStyleCollection)
Item[Int32]

在指定的索引上取得或設定 。ColumnStyle

方法

名稱 Description
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)

在指定位置插入 a ColumnStyleTableLayoutColumnStyleCollection

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
Remove(ColumnStyle)

移除 中 中 特定節點的首次出現ColumnStyleTableLayoutColumnStyleCollection

RemoveAt(Int32)

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

(繼承來源 TableLayoutStyleCollection)
ToString()

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

(繼承來源 Object)

明確介面實作

名稱 Description
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)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

根據指定的型別篩選 IEnumerable 的專案。

適用於

另請參閱