Clipboard.ContainsData(String) 메서드

정의

클립보드에 지정된 데이터 형식의 데이터가 있는지 쿼리합니다.

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

매개 변수

format
String

찾을 데이터의 형식입니다. 미리 정의된 형식은 참조 DataFormats 하세요.

반품

true지정된 형식의 데이터를 클립보드에서 사용할 수 있으면 이고, 그렇지 않으면 . false

예외

formatnull입니다.

예제

다음 예제에서는이 메서드의 사용을 보여 줍니다.


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

설명

데이터 형식에 대한 쿼리이거나 Bitmap 지정된 데이터 형식 FileDrop 으로 데이터를 자동으로 변환할 수 있는 경우 반환 true 됩니다. 다른 데이터 형식의 경우 이 메서드는 지정된 형식을 클립보드에서 기본적으로 사용할 수 있는 경우에만 반환 true 합니다.

적용 대상

추가 정보