Sdílet prostřednictvím


Clipboard.GetData(String) Metoda

Definice

Načte data v zadaném formátu ze schránky.

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

Řetězec, který určuje formát dat, která se mají načíst. Sadu předdefinovaných datových formátů najdete ve DataFormats třídě.

Návraty

Object

Objekt obsahující data v zadaném formátu nebo null pokud data nejsou v zadaném formátu k dispozici.

Výjimky

format je null.

Příklady

Následující příklad ukazuje použití této 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

Platí pro

Viz také