Share via


Clipboard.SetData(String, Object) Metoda

Definice

Uloží zadaná data do schránky v zadaném formátu.

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)

Parametry

format
String

Řetězec, který určuje formát, který se má použít k uložení dat. Prohlédněte si DataFormats třídu pro sadu předdefinovaných datových formátů.

data
Object

Objekt představující data, která se mají uložit do schránky.

Příklady

Následující příklad ukazuje použití této metody.


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

Poznámky

Tato metoda přidá data s povoleným automatickým převodem, pokud je FileDrop odpovídající formát dat nebo Bitmap. V opačném případě je automatický převod zakázán.

Platí pro

Viz také