INestedContainer 介面

定義

提供巢狀容器的功能,巢狀容器邏輯上包含零或多個其他元件,並且由父元件所擁有。Provides functionality for nested containers, which logically contain zero or more other components and are owned by a parent component.

public interface class INestedContainer : IDisposable, System::ComponentModel::IContainer
public interface INestedContainer : IDisposable, System.ComponentModel.IContainer
type INestedContainer = interface
    interface IContainer
    interface IDisposable
Public Interface INestedContainer
Implements IContainer, IDisposable
衍生
實作

備註

介面會將擁有元件的概念新增IContainer至介面。 INestedContainerThe INestedContainer interface adds the concept of an owning component to the IContainer interface. 「嵌套容器」 (nested container) 是邏輯上 (但不一定) 包含零個或多個子元件, 而且是由某個父系元件所擁有的物件。A nested container is an object that logically, but not necessarily visually, contains zero or more child components and is owned by some parent component. 針對視覺內含專案, 擁有的元件通常是另一個容器。For visual containment, the owning component is often another container.

嵌套的容器允許設計控制項的區段, 而不需要明確序列化的成員變數或自訂序列化程式供每個子工作使用。Nested containers allow sections of a control to be designable, without requiring an explicit serialized member variable or a custom serializer for each subcontrol. 相反地, 表單設計工具會維護元件的一個主要容器。Instead, the form designer maintains one master container of components. 每個元件的網站可能會有一個可放置額外元件的位置的嵌套容器。Each component's site may have a nested container that provides a place to put extra components. 當元件放置於嵌套容器中時, 它接收的名稱是其指定名稱及其擁有元件名稱的組合。When a component is sited in a nested container, the name it receives is a combination of its given name and its owning component's name. 此外, 新增至嵌套容器的元件會擁有父容器服務的完整存取權, 而此嵌套容器會提供與加入新元件相關的父系相同行為。Additionally, components added to a nested container have full access to the services of the parent container, and the nested container provides the same behavior of the parent with respect to adding new components. 此嵌套容器會為它所包含的每個元件建立設計工具, 藉此啟用設計階段支援。The nested container will create the designer for each component it contains, thereby enabling design-time support. 由於標準程式碼序列化程式不會查看嵌套的容器, 因此, 只有在主要容器中的元件可以取得它們的路徑時, 才會序列化這些元件。Because standard code serializers do not look at nested containers, these components are only serialized if a path to them can be obtained by walking the components in the primary container.

藉由針對類型INestedContainer的服務查詢元件的網站, 即可找到嵌套的容器。Nested containers can be found by querying a component's site for services of type INestedContainer.

屬性

Components

取得 IContainer 中的所有元件。Gets all the components in the IContainer.

(繼承來源 IContainer)
Owner

取得巢狀容器的主控元件。Gets the owning component for the nested container.

方法

Add(IComponent)

在清單結尾處,將指定的 IComponent 加入 IContainerAdds the specified IComponent to the IContainer at the end of the list.

(繼承來源 IContainer)
Add(IComponent, String)

在清單結尾處,將指定的 IComponent 加入 IContainer,並指派名稱給元件。Adds the specified IComponent to the IContainer at the end of the list, and assigns a name to the component.

(繼承來源 IContainer)
Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(繼承來源 IDisposable)
Remove(IComponent)

IContainer 移除元件。Removes a component from the IContainer.

(繼承來源 IContainer)

適用於

另請參閱