NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataFormats.GetFormat (Int32)

Gets a DataFormats.Format with the Windows Clipboard numeric ID and name for the specified id.

[Visual Basic]
Overloads Public Shared Function GetFormat( _
   ByVal id As Integer _
) As Format
[C#]
public static Format GetFormat(
   int id
);
[C++]
public: static Format* GetFormat(
   int id
);
[JScript]
public static function GetFormat(
   id : int
) : Format;

Parameters

id
The format ID.

Return Value

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

Remarks

Call GetFormat with an ID number when you want to retrieve a DataFormats.Format instance that contains the ID/format name pair.

Call this method with a unique ID number to add the ID/format name pair to the static (in Visual Basic Shared) 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.

Example [Visual Basic]

The following example retrieves a System.WinForms.DataFormat.Format representing name/ID pair for RTF. The contents of the returned object are displayed in a MessageBox. This code assumes Button1 has been instantiated.

[Visual Basic]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   ' Declare a format id and assign it a unique number
   Dim id As Long
   id = 49245
    
   ' Get a DataFormat.Format for rich text format.
   Dim formatObj1 As DataFormats.Format
   Set formatObj1 = DataFormats.GetFormat(id)

   ' Display contents of the formatObj1.
   messagebox.Show "Id value: " & formatobj1.id & vbnewline & _
      "Format name: " & formatobj1.name & vbnewline & _
      "Windows handle needed?: " & formatObj1.win32Handle
End Sub

See Also

DataFormats Class | DataFormats Members | System.WinForms Namespace | DataFormats.GetFormat Overload List | DataFormats.Format