Container 類別

定義

封裝零個或多個元件。

public ref class Container : IDisposable, System::ComponentModel::IContainer
public ref class Container : System::ComponentModel::IContainer
public class Container : IDisposable, System.ComponentModel.IContainer
public class Container : System.ComponentModel.IContainer
type Container = class
    interface IContainer
    interface IDisposable
Public Class Container
Implements IContainer, IDisposable
Public Class Container
Implements IContainer
繼承
Container
衍生
實作

備註

類別 Container 是 介面的預設實作 IContainer

容器是封裝和追蹤零個或多個元件的物件。 在此內容中,內含專案是指邏輯內含專案,而不是視覺內含專案。 您可以在各種案例中使用元件和容器,包括視覺效果而非視覺效果的案例。

容器中的元件會在先進先出清單中追蹤,這也會定義容器內元件的順序。 新增的元件會附加至清單結尾。

建構函式

Container()

初始化 Container 類別的新執行個體。

屬性

Components

取得 Container 中的所有元件。

方法

Add(IComponent)

將指定的 Component 加入至 Container。 元件未命名。

Add(IComponent, String)

將指定的 Component 加入 Container,並指派名稱給它。

CreateSite(IComponent, String)

為指定的 ISite 建立站台 IComponent,並將指定的名稱指派給站台。

Dispose()

釋放 Container 所使用的所有資源。

Dispose(Boolean)

釋放 Container 所使用的 Unmanaged 資源,並選擇性釋放 Managed 資源。

Equals(Object)

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

(繼承來源 Object)
Finalize()

釋出 Unmanaged 資源並執行其他清除作業後,記憶體回收才能重新回收 Container

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetService(Type)

取得指定型別的服務物件 (如果有的話)。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Remove(IComponent)

Container 移除元件。

RemoveWithoutUnsiting(IComponent)

Container 移除元件,而不必將 Site 設定為 null

ToString()

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

(繼承來源 Object)
ValidateName(IComponent, String)

判斷元件名稱對這個容器而言是否唯一。

適用於

另請參閱