次の方法で共有


DataFormats.Dif フィールド

Windows DIF (Data Interchange Format) を指定します。Windows フォームでは、この形式が直接使用されることはありません。この static (Visual Basic では Shared) フィールドは読み取り専用です。

Public Shared ReadOnly Dif As String
[C#]
public static readonly string Dif;
[C++]
public: static String* Dif;
[JScript]
public static var Dif : String;

解説

DIF は ASCII コードで記述され、データベースやスプレッドシートのようなドキュメントを複数のプログラムで使用したり交換したりできるように構成されているフォーマットです。

このフィールドは、データ型を指定するために、 IDataObject インターフェイスと DataObject クラスで使用されます。

IDataObject または DataObject の実装に追加する場合は、 IDataObject.SetData メソッドと DataObject.SetData メソッドの形式として、このフィールドを使用します。

この型のオブジェクトが存在するかどうかを確認するには、 IDataObject.GetDataPresent メソッドと DataObject.GetDataPresent メソッドの形式として、このフィールドを使用します。

この型のオブジェクトを取得するには、 IDataObject.GetData メソッドと DataObject.GetData メソッドの形式として、このフィールドを使用します。

使用例

 
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

[C#] 
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");
}

[C++] 
FileStream* myFileStream = File::Open(S"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(S"The data has been stored in the Dif format is:'{0}'", __box(formatPresent));
} 
else 
{
    Console::WriteLine(S"The data has not been stored in the specified format");
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DataFormats クラス | DataFormats メンバ | System.Windows.Forms 名前空間 | GetData | SetData | GetDataPresent | GetFormats | DataObject | IDataObject | GetFormat | Format.name | Format.id