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); };
public virtual System.ComponentModel.ISite Site { get; set; }
[System.ComponentModel.Browsable(false)]
public virtual System.ComponentModel.ISite Site { get; set; }
member this.Site : System.ComponentModel.ISite with get, set
[<System.ComponentModel.Browsable(false)>]
member this.Site : System.ComponentModel.ISite with get, set
Public Overridable Property Site As ISite

属性值

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.

实现

属性

注解

Component如果已将 ISite 其添加到中,则将具有 IContainer ,并将 IContainer 分配 ISite 给它。A Component will have an ISite if it has been added to an IContainer and the IContainer assigns an ISite to it. IContainer负责将分配 ISiteComponentThe IContainer is responsible for assigning the ISite to the Component. 更改组件的值 ISite 不一定会更改分配到的站点的名称 ComponentChanging the value of the component's ISite does not necessarily change the name of the site the Component is assigned to. Site属性应仅由设置 IContainerThe Site property should be set only by an IContainer.

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

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

适用于

另请参阅