TableLayoutColumnStyleCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
一個收藏物品的 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
- 繼承
範例
以下範例展示了如何設定 ColumnStyle 。TableLayoutColumnStyleCollection 此程式碼範例是控制項所提供 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 |
|---|---|
| AsParallel(IEnumerable) |
啟用查詢的平行處理。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別篩選 IEnumerable 的專案。 |