IPersistComponentSettings 接口

定义

定义存储和检索应用程序设置的控件或类的标准功能。Defines standard functionality for controls or libraries that store and retrieve application settings.

public interface class IPersistComponentSettings
public interface IPersistComponentSettings
type IPersistComponentSettings = interface
Public Interface IPersistComponentSettings

注解

通常,可以通过创建设置包装类(派生自 ApplicationSettingsBase),然后向此类添加特殊属性,将应用程序设置支持添加到应用程序。Typically, you can add application settings support to an application by creating a settings wrapper class, which is derived from ApplicationSettingsBase, and then add special properties to this class. 但是,此方法并不能充分封装控件的应用程序设置,因此无法从详细信息中屏蔽其容器。However, this approach does not sufficiently encapsulate application settings for a control so that its container is shielded from the details. IPersistComponentSettings 接口为应用程序提供了一个标准接口,用于将应用程序设置状态更改请求与控件、组件或库模块通信。The IPersistComponentSettings interface provides an application with a standard interface for communicating application settings state change requests to a control, component, or library module. 设计时工具还依赖于此接口以正确管理控件和组件。Design-time tools also depend on this interface to properly manage controls and components.

属性

SaveSettings

获取或设置一个值,该值指示控件是否应自动保持其应用程序设置属性。Gets or sets a value indicating whether the control should automatically persist its application settings properties.

SettingsKey

获取或设置控件当前实例的应用程序设置键的值。Gets or sets the value of the application settings key for the current instance of the control.

方法

LoadComponentSettings()

将控件的应用程序设置读入相应的属性中,并更新控件状态。Reads the control's application settings into their corresponding properties and updates the control's state.

ResetComponentSettings()

将控件的应用程序设置属性重置为其默认值。Resets the control's application settings properties to their default values.

SaveComponentSettings()

保持控件的应用程序设置属性。Persists the control's application settings properties.

适用于

另请参阅