System.Windows.Forms
1.0.5000.0
2.0.0.0
System.Object
System.Runtime.InteropServices.ComTypes.IDataObject
System.Windows.Forms.IDataObject
System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)
implements the interface, whose methods provide a format-independent mechanism for data transfer.
A is typically used with the and in drag-and-drop operations. The class provides the recommended implementation of the interface. It is suggested that you use the class rather than implementing yourself.
Multiple pieces of data in different formats can be stored in a . Data is retrieved from a by its associated format. Because the target application might not be known, you can increase the likelihood that the data will be in the appropriate format for an application by placing the data in a in multiple formats. See for the predefined formats. You can implement your own format by creating an instance of the class.
To store data in a , pass the data to the constructor or call . You can add data in multiple formats to the same . If you want the data you add to be retrieved in its native format only, call with the parameter set to false.
Data can be retrieved from a in any format which is compatible with . For example, text can be converted to Unicode. To retrieve data in the format in which it was stored, call with the parameter set to false.
To determine what formats the data is stored in, call . To determine if a format is available, call with the desired format.
In dnprdnext, the class provides additional methods that make it easier to work with data in common formats. To add data of a particular format to the , use the appropriate SetFormat method, such as . To retrieve data of a particular format from the , first call the appropriate ContainsFormat method (such as ) to determine whether the contains data in that format, then call the appropriate GetFormat method (such as ) to retrieve the data if the contains it.
Special considerations may be necessary when using the metafile format with the Clipboard. Due to a limitation in the current implementation of the class, the metafile format used by the .NET Framework may not be recognized by applications that use an older metafile format. In this case, you must interoperate with the Win32 Clipboard application programming interfaces (APIs). For more information, see article 323530, "Metafiles on Clipboard Are Not Visible to All Applications," in the Microsoft Knowledge Base at http://support.microsoft.com.
An object must be serializable for it to be put on the Clipboard. See for more information on serialization. If your target application requires a very specific data format, the headers added to the data in the serialization process may prevent the application from recognizing your data. To preserve your data format, add your data as a array to a and pass the to the method.
Implements a basic data transfer mechanism.
Constructor
To be added.
Initializes a new instance of the class.
1.0.5000.0
2.0.0.0
Constructor
You can add data in any format to the when you use this constructor, or you can add data as an to provide multiple formats at once. If you are familiar with COM programming, you can also add a data object that implements the COM IDataObject interface. For more information, see IDataObject in the MSDN library at http://msdn.microsoft.com/library.
Initializes a new instance of the class and adds the specified object to it.
The data to store.
1.0.5000.0
2.0.0.0
Constructor
To be added.
Initializes a new instance of the class and adds the specified object in the specified format.
The format of the specified data. See for predefined formats.
The data to store.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Boolean
Use this method to determine whether the data object contains audio data before retrieving it with the method.
Indicates whether the data object contains data in the format.
true if the data object contains audio data; otherwise, false.
Method
2.0.0.0
System.Boolean
A file drop list is a collection of strings containing path information for files.
Use this method to determine whether the data object contains a file drop list before retrieving it with the method.
Indicates whether the data object contains data that is in the format or can be converted to that format.
true if the data object contains a file drop list; otherwise, false.
Method
2.0.0.0
System.Boolean
Use this method to determine whether the data object contains image data before retrieving it with the method.
Indicates whether the data object contains data that is in the format or can be converted to that format.
true if the data object contains image data; otherwise, false.
Method
2.0.0.0
System.Boolean
Use this method to determine whether the data object contains text data before retrieving it with the method.
Indicates whether the data object contains data in the format.
true if the data object contains text data; otherwise, false.
Method
2.0.0.0
System.Boolean
Use this method to determine whether the data object contains text data before retrieving it with the method.
Indicates whether the data object contains text data in the format indicated by the specified value.
true if the data object contains text data in the specified format; otherwise, false.
One of the values.
Method
2.0.0.0
System.IO.Stream
Use the method to determine whether the data object contains audio data before retrieving it with this method.
Use the method to add audio data to the data object.
Retrieves an audio stream from the data object.
A containing audio data or null if the data object does not contain any data in the format.
Method
System.Object
If this method cannot find data in the specified format, it attempts to convert the data to the format. If the data cannot be converted to the specified format, or if the data was stored with automatic conversion set to false, this method returns null.
To determine whether data is associated with, or can be converted to, a format, call before calling . Call for a list of valid formats for the data stored in this .
Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
Returns the data associated with the specified data format.
The data associated with the specified format, or null.
The format of the data to retrieve. See for predefined formats.
1.0.5000.0
2.0.0.0
Method
System.Object
If this method cannot find data in the specified format, it attempts to convert the data to the format. If the data cannot be converted to the specified format, or if the data was stored with automatic conversion set to false, this method returns null.
To determine whether data is associated with, or can be converted to, a format, call before calling . Call for a list of valid formats for the data stored in this .
Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
Returns the data associated with the specified class type format.
The data associated with the specified format, or null.
A representing the format of the data to retrieve.
1.0.5000.0
2.0.0.0
Method
System.Object
If the parameter is true and this method cannot find data in the specified format, it attempts to convert the data to the format. If the data cannot be converted to the specified format, or if the data was stored with the automatic conversion set to false, this method returns null.
If the parameter is false, this method returns data in the specified format, or null if no data in this format can be found.
To determine whether data is associated with, or can be converted to, a format, call before calling . Call for a list of valid formats for the data stored in this .
Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
Returns the data associated with the specified data format, using an automated conversion parameter to determine whether to convert the data to the format.
The data associated with the specified format, or null.
The format of the data to retrieve. See for predefined formats.
true to the convert data to the specified format; otherwise, false.
1.0.5000.0
2.0.0.0
Method
System.Boolean
Call this method to determine whether a format exists before calling . Call for the formats that are available in this .
Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
If no data can be retrieved, no exception will be thrown. Instead, false will be returned.
Determines whether data stored in this is associated with, or can be converted to, the specified format.
true if data stored in this is associated with, or can be converted to, the specified format; otherwise, false.
The format to check for. See for predefined formats.
1.0.5000.0
2.0.0.0
Method
System.Boolean
Call this method to determine whether a format exists before calling . Call for the formats that are available in this .
Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
If no data can be retrieved, no exception will be thrown. Instead, false will be returned.
Determines whether data stored in this is associated with, or can be converted to, the specified format.
true if data stored in this is associated with, or can be converted to, the specified format; otherwise, false.
A representing the format to check for.
1.0.5000.0
2.0.0.0
Method
System.Boolean
Call this method to determine whether a format exists before calling . Call for the formats that are available in this .
This method returns true when:
-
The parameter is true and the data is in a format that can be converted to the appropriate format.
-
The parameter is false and the data is in the appropriate format.
This method returns false when:
-
The parameter is true and this method cannot find data in the specified format, and it cannot convert data to the specified format, or the data was stored with automatic conversion set to false.
-
The parameter is false and data does not exist in this in the specified format.
Data can be converted to another format if it was stored specifying that conversion is allowed and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
If no data can be retrieved, no exception will be thrown. Instead, false will be returned.
Determines whether this contains data in the specified format or, optionally, contains data that can be converted to the specified format.
true if the data is in, or can be converted to, the specified format; otherwise, false.
The format to check for. See for predefined formats.
true to determine whether data stored in this can be converted to the specified format; false to check whether the data is in the specified format.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Collections.Specialized.StringCollection
A file drop list is a collection of strings containing path information for files.
A file drop list is stored in a data object as a array. This method converts this array to a and returns the collection.
Use the method to determine whether the data object contains a file drop list before retrieving it with this method.
Use the method to add a file drop list to the data object.
Retrieves a collection of file names from the data object.
A containing file names or null if the data object does not contain any data that is in the format or can be converted to that format.
Method
System.String[]
Call this method to get the supported data formats before calling . See for the predefined formats.
Data can be converted to another format if it was stored specifying that conversion is allowed and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
Returns a list of all formats that data stored in this is associated with or can be converted to.
An array of type , containing a list of all formats that are supported by the data stored in this object.
1.0.5000.0
2.0.0.0
Method
System.String[]
Call this method to get the supported data formats before calling . See for the predefined formats.
Data can be converted to another format if it was stored specifying that conversion is allowed and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
Returns a list of all formats that data stored in this is associated with or can be converted to, using an automatic conversion parameter to determine whether to retrieve only native data formats or all formats that the data can be converted to.
An array of type , containing a list of all formats that are supported by the data stored in this object.
true to retrieve all formats that data stored in this is associated with, or can be converted to; false to retrieve only native data formats.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Drawing.Image
Use the method to determine whether the data object contains image data before retrieving it with this method.
Use the method to add image data to the data object.
Retrieves an image from the data object.
An representing the image data in the data object or null if the data object does not contain any data that is in the format or can be converted to that format.
Method
2.0.0.0
System.String
Use the method to determine whether the data object contains text data before retrieving it with this method.
Use the method to add text data to the data object.
Retrieves text data from the data object in the format.
The text data in the data object or if the data object does not contain data in the format.
Method
2.0.0.0
System.String
Use the method to determine whether the data object contains text data before retrieving it with this method.
Use the method to add text data to the data object.
Retrieves text data from the data object in the format indicated by the specified value.
The text data in the data object or if the data object does not contain data in the specified format.
One of the values.
Method
2.0.0.0
System.Void
To retrieve audio data from the data object, first use the method to determine whether the data object contains audio data before retrieving it with the method.
Adds a array to the data object in the format after converting it to a .
A array containing the audio data.
Method
2.0.0.0
System.Void
To retrieve audio data from the data object, first use the method to determine whether the data object contains audio data before retrieving it with the method.
Adds a to the data object in the format.
A containing the audio data.
Method
System.Void
If you do not know the format of the target application, you can store data in multiple formats using this method. Data stored using this method can be converted to a compatible format when it is retrieved.
The overload stores the value in a format that it determines by calling the method. If implements the interface, this overload also stores the value in the format.
Adds the specified object to the using the object type as the data format.
The data to store.
1.0.5000.0
2.0.0.0
Method
System.Void
If you do not know the format of the target application, you can store data in multiple formats using this method.
Data stored using this method can be converted to a compatible format when it is retrieved.
Adds the specified object to the using the specified format.
The format associated with the data. See for predefined formats.
The data to store.
1.0.5000.0
2.0.0.0
Method
System.Void
If you do not know the format of the target application, you can store data in multiple formats using this method.
Data stored using this method can be converted to a compatible format when it is retrieved.
Adds the specified object to the using the specified type as the format.
A representing the format associated with the data.
The data to store.
1.0.5000.0
2.0.0.0
Method
System.Void
If you do not know the format of the target application, you can store data in multiple formats using this method.
Adds the specified object to the using the specified format and indicating whether the data can be converted to another format.
The format associated with the data. See for predefined formats.
true to allow the data to be converted to another format; otherwise, false.
The data to store.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Void
A file drop list is a collection of strings containing path information for files.
A file drop list is stored in a data object as a array. This method converts to a array before adding it to the data object.
To retrieve a file drop list from the data object, first use the method to determine whether the data object contains data in that format before retrieving it with the method.
Adds a collection of file names to the data object in the format.
A containing the file names.
Method
2.0.0.0
System.Void
To retrieve image data from the data object, first use the method to determine whether the data object contains image data before retrieving it with the method.
Adds an to the data object in the format.
The to add to the data object.
Method
2.0.0.0
System.Void
To retrieve text data from the data object, first use the method to determine whether the data object contains image data before retrieving it with the method.
Adds text data to the data object in the format.
The text to add to the data object.
Method
2.0.0.0
System.Void
To retrieve text data from the data object, first use the method to determine whether the data object contains image data before retrieving it with the method.
Adds text data to the data object in the format indicated by the specified value.
The text to add to the data object.
One of the values.
Method
2.0.0.0
System.Int32
To be added.
To be added.
To be added.
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
This member is an explicit interface member implementation. It can be used only when the is cast to an interface.
Destroys a notification connection that had been previously established.
This method supports the following return values:
-
Value
Description
-
S_OK
The specified connection was successfully deleted.
-
OLE_E_NOCONNECTION
The specified connection is not valid.
-
OLE_E_ADVISENOTSUPPORTED
This implementation does not support notification.
Method
2.0.0.0
System.Int32
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Runtime.InteropServices.ComTypes.IEnumFORMATETC
To be added.
This member is an explicit interface member implementation. It can be used only when the is cast to an interface.
Creates an object for enumerating the structures for a data object. These structures are used in calls to or .
This method supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following:
-
Value
Description
-
S_OK
The enumerator object was successfully created.
-
E_NOTIMPL
The direction specified by the parameter is not supported.
-
OLE_S_USEREG
Requests that OLE enumerate the formats from the registry.
Method
2.0.0.0
System.Int32
To be added.
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Int32
To be added.
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
To be added.
To be added.
To be added.
To be added.