DataFormats.Dif 字段

定义

指定 Windows 数据交换格式 (DIF),Windows 窗体不直接使用此格式。 此 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 代码组成的格式,可在其中构建数据库、电子表格和类似文档,以便于它们通过其他程序使用和传输到其他程序。

接口和 DataObject 类使用此IDataObject字段来指定数据类型。

将 添加到 IDataObject 或 的DataObject实现时,请使用此字段作为 和 DataObject.SetData 方法的格式IDataObject.SetData

若要查看是否存在此类型的对象,请使用此字段作为 和 DataObject.GetDataPresent 方法的格式IDataObject.GetDataPresent

若要获取此类型的对象,请使用此作为 和 DataObject.GetData 方法的格式IDataObject.GetData

适用于

另请参阅