Clipboard.SetData(String, Object) Methode

Definition

Speichert die angegebenen Daten im angegebenen Format in der Zwischenablage.

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)

Parameter

format
String

Eine Zeichenfolge, die das zum Speichern der Daten zu verwendende Format angibt. Einen Satz vordefinierter Datenformate finden Sie in der DataFormats-Klasse.

data
Object

Ein Objekt, das die in der Zwischenablage zu speichernden Daten darstellt.

Beispiele

Im folgenden Beispiel wird die Verwendung dieser Methode veranschaulicht.


// 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))

Hinweise

Diese Methode fügt Daten mit aktivierter automatischer Konvertierung hinzu, wenn das entsprechende Datenformat oder BitmapistFileDrop. Andernfalls ist die automatische Konvertierung deaktiviert.

Gilt für:

Weitere Informationen