Clipboard.GetData(String) 메서드

정의

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

public:
 static System::Object ^ GetData(System::String ^ format);
public static object GetData(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 참조하세요.

반품

지정된 형식의 데이터를 포함하거나 null 지정된 형식으로 데이터를 사용할 수 없는 개체입니다.

예외

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

적용 대상

추가 정보