Component.Site 属性


获取或设置 ComponentISiteGets or sets the ISite of the Component.

 virtual property System::ComponentModel::ISite ^ Site { System::ComponentModel::ISite ^ get(); void set(System::ComponentModel::ISite ^ value); };
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;如果 Component 未封装在 IContainer 中,Component 没有与其关联的 ISite 或者 Component 已从其 IContainer 中移除,则为 nullThe 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.




ISite IContainer ISite如果已将其IContainer添加到中, 则将具有, 并将分配给它。 ComponentA Component will have an ISite if it has been added to an IContainer and the IContainer assigns an ISite to it. 负责IContainerISite分配给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. 属性应仅IContainer由设置。 SiteThe Site property should be set only by an IContainer.

如果从其null 移除IContainer, 则属性值为。 ComponentThe property value is null if the Component is removed from its IContainer. 分配null给此属性不一定会Component从中IContainer删除。Assigning null to this property does not necessarily remove the Component from the IContainer.

Component可能有也可能没有名称。A Component might or might not have a name. 如果为指定了名称, 则该名称在其IContainer内的其他Component对象中必须是唯一的。 ComponentIf a Component is given a name, the name must be unique among other Component objects within its IContainer. 存储的Component名称; 因此, 如果有与之ISite关联的, 则只能命名为ComponentISiteThe ISite stores the name of the Component; therefore, you can only name a Component if it has an ISite associated with it.