Component.Site Component.Site Component.Site Component.Site Property

定义

获取或设置 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;如果 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如果已添加到IContainerIContainer分配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不一定是不更改站点的名称Component分配给。Changing 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到此属性不一定会删除ComponentIContainerAssigning 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如果它具有ISite与之关联。The ISite stores the name of the Component; therefore, you can only name a Component if it has an ISite associated with it.

适用于

另请参阅