Clipboard.SetData(String, Object) Método

Definição

Armazena os dados especificados na Área de Transferência no formato especificado.

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)

Parâmetros

format
String

Uma cadeia que especifica o formato a usar para armazenar os dados. Consulte a DataFormats classe para um conjunto de formatos de dados predefinidos.

data
Object

Um objeto que representa os dados a armazenar na Prancheta.

Exemplos

O exemplo seguinte demonstra a utilização deste método.


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

Observações

Este método adiciona dados com a conversão automática ativada se o formato de dados correspondente for FileDrop ou Bitmap. Caso contrário, a conversão automática fica desativada.

Aplica-se a

Ver também