Clipboard.GetData(String) 메서드

정의

클립보드에서 지정된 형식의 데이터를 검색합니다.

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

매개 변수

format
String

검색할 데이터 형식을 지정하는 문자열입니다. 미리 정의된 데이터 형식 집합은 DataFormats 클래스를 참조하세요.

반환

Object

지정된 형식의 데이터가 들어 있는 개체이거나, 지정된 형식의 데이터가 없으면 null입니다.

예외

format이(가) null인 경우

예제

다음 예제에서는이 메서드를 사용 하는 방법을 보여 줍니다.


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

적용 대상

추가 정보