DataFormats.Dif Pole

Definicja

Określa format Windows Data Interchange (DIF), który Windows Forms nie jest używany bezpośrednio. To static pole jest tylko do odczytu.

public: static initonly System::String ^ Dif;
public static readonly string Dif;
 staticval mutable Dif : string
Public Shared ReadOnly Dif As String 

Wartość pola

String

Przykłady

W poniższym przykładzie kodu pokazano użycie tego elementu członkowskiego.

FileStream^ myFileStream = File::Open( "Temp.dif", FileMode::Open );

// Store the data into Dif format.
DataObject^ myDataObject = gcnew DataObject;
myDataObject->SetData( DataFormats::Dif, myFileStream );

// Check whether the data is stored or not in the specified format.
bool formatPresent = myDataObject->GetDataPresent( DataFormats::Dif );
if ( formatPresent )
{
   Console::WriteLine( "The data has been stored in the Dif format is:'{0}'", formatPresent );
}
else
{
   Console::WriteLine( "The data has not been stored in the specified format" );
}
 FileStream myFileStream = File.Open("Temp.dif",FileMode.Open);
 // Store the data into Dif format.
 DataObject myDataObject = new DataObject();
 myDataObject.SetData(DataFormats.Dif,myFileStream);

// Check whether the data is stored or not in the specified format.
bool formatPresent = myDataObject.GetDataPresent(DataFormats.Dif);
 if(formatPresent) 
 {
    Console.WriteLine("The data has been stored in the Dif format is:'"+formatPresent+"'");
 } 
 else 
 {
    Console.WriteLine("The data has not been stored in the specified format");
 }
Dim myFileStream As FileStream = File.Open("Temp.dif", FileMode.Open)
' Store the data into Dif format.
Dim myDataObject As New DataObject()
myDataObject.SetData(DataFormats.Dif, myFileStream)

' Check whether the data is stored or not in the specified format.
Dim formatPresent As Boolean = myDataObject.GetDataPresent(DataFormats.Dif)
If formatPresent Then
   Console.WriteLine(("The data has been stored in the Dif format is:'" + formatPresent.ToString() + "'"))
Else
   Console.WriteLine("The data has not been stored in the specified format")
End If

Uwagi

DIF to format składający się z kodów ASCII, w których baza danych, arkusz kalkulacyjny i podobne dokumenty mogą być ustrukturyzowane w celu ułatwienia ich używania i transferu do innych programów.

To pole jest używane przez IDataObject interfejs i klasę DataObject do określania typu danych.

Podczas dodawania do elementu lub do IDataObject implementacji DataObjectprogramu użyj tego pola jako formatu metod IDataObject.SetData i DataObject.SetData .

Aby sprawdzić, czy obiekt tego typu istnieje, użyj tego pola jako formatu metod IDataObject.GetDataPresent i DataObject.GetDataPresent .

Aby uzyskać obiekt tego typu, użyj go jako formatu metod IDataObject.GetData i DataObject.GetData .

Dotyczy

Zobacz też