Langage

Clipboard.SetData(String, Object) Méthode

Définition

Stocke les données spécifiées dans le Presse-papiers au format spécifié.

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)

Paramètres

format
String

Chaîne qui spécifie le format à utiliser pour stocker les données. Consultez la DataFormats classe pour un ensemble de formats de données prédéfinis.

data
Object

Objet représentant les données à stocker dans le Presse-papiers.

Exemples

L’exemple suivant illustre l’utilisation de cette méthode.


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

Remarques

Cette méthode ajoute des données avec la conversion automatique activée si le format de données correspondant est FileDrop ou Bitmap. Sinon, la conversion automatique est désactivée.

S’applique à

Voir aussi