Component.Site 屬性

定義

取得或設定 ComponentISiteGets or sets the ISite of the Component.

public:
 virtual property System::ComponentModel::ISite ^ Site { System::ComponentModel::ISite ^ get(); void set(System::ComponentModel::ISite ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual System.ComponentModel.ISite Site { get; set; }
member this.Site : System.ComponentModel.ISite with get, set
Public Overridable Property Site As ISite

屬性值

ISite 關聯的 Component。如果 null 未封裝在 ComponentIContainer 沒有關聯的 Component,或 ISite 從其 Component 移除,則為 IContainerThe ISite associated with the Component, or null if the Component is not encapsulated in an IContainer, the Component does not have an ISite associated with it, or the Component is removed from its IContainer.

實作

屬性

備註

如果 Component 已加入 IContainer,而且 IContainerISite 指派給它,則會有 ISiteA Component will have an ISite if it has been added to an IContainer and the IContainer assigns an ISite to it. IContainer 負責將 ISite 指派給 ComponentThe IContainer is responsible for assigning the ISite to the Component. 變更元件 ISite 的值,不一定會變更指派 Component 的網站名稱。Changing the value of the component's ISite does not necessarily change the name of the site the Component is assigned to. Site 屬性只能由 IContainer設定。The Site property should be set only by an IContainer.

如果 Component 從其 IContainer中移除,則會 null 屬性值。The property value is null if the Component is removed from its IContainer. null 指派給這個屬性並不一定會從 IContainer移除 ComponentAssigning null to this property does not necessarily remove the Component from the IContainer.

Component 不一定會有名稱。A Component might or might not have a name. 如果 Component 指定了名稱,此名稱在其 IContainer內的其他 Component 物件中必須是唯一的。If a Component is given a name, the name must be unique among other Component objects within its IContainer. ISite 儲存 Component的名稱;因此,只有當 Component 有與其相關聯的 ISite 時,您才能命名。The ISite stores the name of the Component; therefore, you can only name a Component if it has an ISite associated with it.

適用於

另請參閱