Clipboard.GetData(String) Metoda

Definicja

Pobiera dane w określonym formacie ze Schowka.

public:
 static System::Object ^ GetData(System::String ^ format);
public static object GetData (string format);
static member GetData : string -> obj
Public Shared Function GetData (format As String) As Object

Parametry

format
String

Ciąg określający format danych do pobrania. Aby uzyskać zestaw wstępnie zdefiniowanych formatów danych, zobacz klasę DataFormats .

Zwraca

Object

Obiekt, który zawiera dane w określonym formacie lub null jeśli dane są niedostępne w określonym formacie.

Wyjątki

format to null.

Przykłady

W poniższym przykładzie pokazano użycie tej metody.


// After this line executes, IsHTMLDataOnClipboard will be true if
// HTML data is available natively on the clipboard; if not, it 
// will be false.
bool IsHTMLDataOnClipboard = Clipboard.ContainsData(DataFormats.Html);

// If there is HTML data on the clipboard, retrieve it.
string htmlData;
if(IsHTMLDataOnClipboard)
{

    htmlData = Clipboard.GetText(TextDataFormat.Html);
}

' After this line executes, IsHTMLDataOnClipboard will be true if
' HTML data is available natively on the clipboard; if not, it 
' will be false.
Dim IsHTMLDataOnClipboard As Boolean = Clipboard.ContainsData(DataFormats.Html)

' If there is HTML data on the clipboard, retrieve it.
Dim htmlData As String
If IsHTMLDataOnClipboard Then

    htmlData = Clipboard.GetText(TextDataFormat.Html)

End If

Dotyczy

Zobacz też