IComponentInitializer 接口

定义

在组件创建期间提供一组推荐的默认值。Provides a set of recommended default values during component creation.

public interface class IComponentInitializer
public interface IComponentInitializer
type IComponentInitializer = interface
Public Interface IComponentInitializer
派生

注解

任何设计器都可以实现 IComponentInitializer 接口,设计器是一个组件,该组件还实现 IDesigner,后者接收所设计组件的建议默认值集。The IComponentInitializer interface can be implemented by any designer, which is a component that also implements IDesigner, which receives a recommended set of default values for the component it is designing. 在创建新组件期间查询 IComponentInitializerIComponentInitializer is queried during new component creation. 在字典中以名称/值对的形式传递组件的属性的建议默认值。Recommended default values for the component's properties are passed in as name/value pairs in a dictionary.

此设计提供了两个自定义点:可以替换或更改工具箱项本身以执行自定义操作,也可以更改组件的设计器以提供自定义操作。This design provides two customization points: the toolbox item itself can be replaced or changed to perform custom actions, or the designer for a component can be changed to provide a custom action. 实现 IComponentInitializer 的设计器不应依赖于其任一方法(InitializeNewComponentInitializeExistingComponent 调用),因为工具箱项不必调用这些方法。A designer that implements IComponentInitializer should not depend on either of its methods - InitializeNewComponent or InitializeExistingComponent - being called, because toolbox items are not obligated to call these methods.

有关创建设计组件的概述,请参阅扩展设计时支持For an overview of creating design components, see Extending Design-Time Support.

方法

InitializeExistingComponent(IDictionary)

将组件的实例还原为其默认状态。Restores an instance of a component to its default state.

InitializeNewComponent(IDictionary)

使用一组推荐值初始化新组件。Initializes a new component using a set of recommended values.

适用于

另请参阅