Taal

Clipboard.ContainsData(String) Methode

Definitie

Query's uitvoeren op het Klembord voor de aanwezigheid van gegevens in een opgegeven gegevensindeling.

public:
 static bool ContainsData(System::String ^ format);
public static bool ContainsData(string format);
static member ContainsData : string -> bool
Public Shared Function ContainsData (format As String) As Boolean

Parameters

format
String

De indeling van de te zoeken gegevens. Zie DataFormats voor vooraf gedefinieerde indelingen.

Retouren

true als gegevens in de opgegeven indeling beschikbaar zijn op het Klembord; anders, false.

Uitzonderingen

format is null.

Voorbeelden

In het volgende voorbeeld ziet u het gebruik van deze methode.


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

Opmerkingen

Een query voor de gegevensindeling Bitmap of FileDrop retourneert true als de gegevens automatisch kunnen worden geconverteerd naar de opgegeven gegevensindeling. Voor andere gegevensindelingen retourneert true deze methode alleen als de opgegeven indeling standaard beschikbaar is op het Klembord.

Van toepassing op

Zie ook