IDataObject 接口

定义

为传送数据提供与格式无关的机制。Provides a format-independent mechanism for transferring data.

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

注解

IDataObject接口由 Clipboard 类用于数据传输操作,例如拖放操作。The IDataObject interface is used by the Clipboard class for data transfer operations like drag-and-drop.

当由类实现时, IDataObject 方法使单个数据对象能够以多种格式提供数据。When implemented by a class, the IDataObject methods enable a single data object to offer data in multiple formats. 使用多种格式提供数据往往使数据比仅支持单一数据格式的应用程序更广泛地使用。Offering data in multiple formats tends to make the data usable by a wider variety of applications than if only a single data format were supported.

DataObject类提供接口的基本实现 IDataObjectThe DataObject class provides a basic implementation of the IDataObject interface.

方法

GetData(String)

检索指定格式的数据对象;数据格式由字符串指定。Retrieves a data object in a specified format; the data format is specified by a string.

GetData(String, Boolean)

检索指定格式的数据对象,可选择将数据转换为指定格式。Retrieves a data object in a specified format, optionally converting the data to the specified format.

GetData(Type)

检索指定格式的数据对象;数据格式由 Type 对象指定。Retrieves a data object in a specified format; the data format is specified by a Type object.

GetDataPresent(String)

查看指定格式的数据是否可用,或者是否可以转换为指定格式;数据格式由一个字符串指定。Checks to see whether the data is available in, or can be converted to, a specified format; the data format is specified by a string.

GetDataPresent(String, Boolean)

查看是否具有指定格式的数据,或者数据是否可以转换为指定格式。Checks to see whether the data is available in, or can be converted to, a specified format. Boolean 标志指示,如果指定格式的数据不可用,是否检查能否将数据转换为此格式。A Boolean flag indicates whether to check if the data can be converted to the specified format, if it is not available in that format.

GetDataPresent(Type)

查看是否具有指定格式的数据,或者数据是否可以转换为指定格式。Checks to see whether the data is available in, or can be converted to, a specified format. 数据格式由 Type 对象指定。The data format is specified by a Type object.

GetFormats()

返回一个所有格式的列表,此数据对象中的数据以这些格式存储,或可以转换为这些格式。Returns a list of all formats that the data in this data object is stored in, or can be converted to.

GetFormats(Boolean)

返回一个所有格式列表,此数据对象中的数据以这些格式存储。Returns a list of all formats that the data in this data object is stored in. Boolean 标志指示是否亦包含可将数据自动转换为的格式。A Boolean flag indicates whether or not to also include formats that the data can be automatically converted to.

SetData(Object)

在此数据对象中存储指定的数据,同时自动从源对象类型转换数据格式。Stores the specified data in this data object, automatically converting the data format from the source object type.

SetData(String, Object)

在此数据对象中存储指定的数据,以及一种或多种指定的数据格式。Stores the specified data in this data object, along with one or more specified data formats. 数据格式由字符串指定。The data format is specified by a string.

SetData(String, Object, Boolean)

在此数据对象中存储指定的数据,以及一种或多种指定的数据格式。Stores the specified data in this data object, along with one or more specified data formats. 此重载包含一个 Boolean 标志,用于指示是否可在检索时将数据转换为其他格式。This overload includes a Boolean flag to indicate whether the data may be converted to another format on retrieval.

SetData(Type, Object)

在此数据对象中存储指定的数据,以及一种或多种指定的数据格式。Stores the specified data in this data object, along with one or more specified data formats. 数据格式由 Type 类指定。The data format is specified by a Type class.

适用于