DataFormats::GetFormat Method (Int32)

 

Returns a DataFormats::Format with the Windows Clipboard numeric ID and name for the specified ID.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
static DataFormats::Format^ GetFormat(
	int id
)

Parameters

id
Type: System::Int32

The format ID.

Return Value

Type: System.Windows.Forms::DataFormats::Format^

A DataFormats::Format that has the Windows Clipboard numeric ID and the name of the format.

This member is typically used to register native Clipboard formats.

Call GetFormat with an ID number when you want to retrieve a DataFormats::Format instance that contains the ID/format name pair. Typically, the ID name and number is published by the creator of the application that you are using the Clipboard to interface with. For example, the ID number for Dynamic Data Exchange (DDE) conversation information in Visual Basic is &HBF00, and the format name is vbCFLink.

Call this method with any unique ID number to add the ID/format name pair to the static list of format name/ID pairs in the DataFormats class. The new name will be created by concatenating "Format" and the ID number. This pair is not registered as a new Clipboard format because you have not provided a name.

The following code example demonstrates the use of this member.

using namespace System;
using namespace System::Windows::Forms;
int main()
{

   // Create a DataFormats::Format for the Unicode data format.
   DataFormats::Format^ myFormat = DataFormats::GetFormat( 13 );

   // Display the contents of myFormat.
   Console::WriteLine( "The Format Name corresponding to the ID {0} is :", myFormat->Id );
   Console::WriteLine( myFormat->Name );
}

.NET Framework
Available since 1.1
Return to top
Show: