Clipboard.SetData(String, Object) メソッド

定義

指定したデータを指定した形式でクリップボードに格納します。

public:
 static void SetData(System::String ^ format, System::Object ^ data);
public static void SetData (string format, object data);
static member SetData : string * obj -> unit
Public Shared Sub SetData (format As String, data As Object)

パラメーター

format
String

データの格納に使用する形式を指定する文字列。 定義済みのデータ形式のセットについては、DataFormats クラスのトピックを参照してください。

data
Object

クリップボードに格納するデータを表すオブジェクト。

次の例では、このメソッドの使用方法を示します。


// For this example, the data to be placed on the clipboard is a simple
// string.
string textData = "I want to put this string on the clipboard.";

// After this call, the data (string) is placed on the clipboard and tagged
// with a data format of "Text".
Clipboard.SetData(DataFormats.Text, (Object)textData);
' For this example, the data to be placed on the clipboard is a simple
' string.
Dim textData As String = "I want to put this string on the clipboard."

' After this call, the data (string) is placed on the clipboard and tagged
' with a data format of "Text".
Clipboard.SetData(DataFormats.Text, CType(textData, Object))

注釈

このメソッドは、対応するデータ形式が FileDrop または Bitmapの場合に、自動変換が有効になっているデータを追加します。 それ以外の場合、自動変換は無効になります。

適用対象

こちらもご覧ください