Clipboard.SetData(String, Object) Metoda

Definicja

Przechowuje określone dane w Schowku w określonym formacie.

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

Ciąg określający format używany do przechowywania danych. Zobacz klasę DataFormats , aby zapoznać się z zestawem wstępnie zdefiniowanych formatów danych.

data
Object

Obiekt reprezentujący dane do przechowywania w Schowku.

Przykłady

W poniższym przykładzie pokazano użycie tej 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))

Uwagi

Ta metoda dodaje dane z włączoną automatyczną konwersją, jeśli odpowiedni format danych to FileDrop lub Bitmap. W przeciwnym razie automatyczna konwersja jest wyłączona.

Dotyczy

Zobacz też