Component.Site 属性

定义

获取或设置 ISiteComponentGets 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 未封装在 Component 中,IContainer 没有与其关联的 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,并且 IContainer 向其分配了 ISite,则会有一个 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.

如果从其 IContainer中移除了 Component,则 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的名称;因此,如果有一个与之关联的 ISite,则只能命名 ComponentThe ISite stores the name of the Component; therefore, you can only name a Component if it has an ISite associated with it.

适用于

另请参阅