DataFormats.Dif 欄位

定義

規定 Windows 資料交換格式(DIF),Windows Forms 並未直接使用此格式。 此 static 欄位為唯讀。

public: static initonly System::String ^ Dif;
public static readonly string Dif;
 staticval mutable Dif : string
Public Shared ReadOnly Dif As 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 編碼組成的格式,資料庫、試算表及類似文件可被結構化,以便於其他程式使用及傳輸。

此欄位由介面與IDataObject類別用DataObject來指定資料型態。

在為 的實作 或 添加IDataObject時,請使用此欄位作為 DataObjectIDataObject.SetData 方法的DataObject.SetData格式。

要判斷是否有此類物件存在,請使用此欄位作為 and IDataObject.GetDataPresent methods 的格式DataObject.GetDataPresent

要取得此類物件,請使用此格式來表示 IDataObject.GetData and DataObject.GetData 方法。

適用於

另請參閱