共用方式為


DataFormats.Dif 欄位

定義

指定 Windows 資料交換格式 (DIF),Windows Form 不會直接使用這種格式。 這個 static 欄位是唯讀的。

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

欄位值

String

範例

下列程式碼範例示範如何使用這個成員。

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

備註

DIF 是一種格式,由 ASCII 程式碼所組成,其中資料庫、試算表和類似的檔可以結構化,以便透過其他程式使用及傳送至其他程式。

介面和 DataObject 類別會使用此 IDataObject 欄位來指定資料類型。

將 加入 IDataObject 至 或 的實作 DataObject 時,請使用此欄位做為 和 DataObject.SetData 方法的格式 IDataObject.SetData

若要查看此類型的物件是否存在,請使用此欄位做為 和 DataObject.GetDataPresent 方法的格式 IDataObject.GetDataPresent

若要取得此類型的物件,請使用這個 做為 和 DataObject.GetData 方法的格式 IDataObject.GetData

適用於

另請參閱