Clipboard.IsCurrent(IDataObject) 메서드

정의

지정된 데이터 개체를 클립보드의 콘텐츠와 비교합니다.

public:
 static bool IsCurrent(System::Windows::IDataObject ^ data);
public static bool IsCurrent (System.Windows.IDataObject data);
static member IsCurrent : System.Windows.IDataObject -> bool
Public Shared Function IsCurrent (data As IDataObject) As Boolean

매개 변수

data
IDataObject

시스템 클립보드의 콘텐츠와 비교할 데이터 개체입니다.

반환

Boolean

지정된 데이터 개체가 시스템 클립보드의 개체와 일치하면 true이고, 그렇지 않으면 false입니다.

예외

data이(가) null인 경우

클립보드에 액세스하는 동안 오류가 발생한 경우. 예외 정보에는 구체적인 오류를 식별하는 HResult가 포함됩니다. ErrorCode를 참조하십시오.

예제

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


               // For this example, the data to be placed on the clipboard is a simple
               // string.
               string textData = "I want to put this string on the clipboard.";
               // The example will enable auto-conversion of data for this data object.
               bool autoConvert = true;

               // Create a new data object, specifying the data format, data to encapsulate, and enabling
               // auto-conversion services.
               DataObject data = new DataObject(DataFormats.UnicodeText, (Object)textData, autoConvert);
               
               // If the data to be copied is supposed to be persisted after the application ends, 
               // then set the second parameter of SetDataObject to true.
               if(persistentData)
               {
                   // Place the persisted data on the clipboard.
                   Clipboard.SetDataObject(data, true);
               }
               else
               {
                   // Place the non-persisted data on the clipboard.
                   Clipboard.SetDataObject(data, false);
               }

               // If you keep a copy of the source data object, you can use the IsCurrent method to see if
               // the data object is still on the clipboard.
               bool isOriginalDataObject = Clipboard.IsCurrent(data);

' For this example, the data to be placed on the clipboard is a simple
' string.
Dim textData As String = "I want to put this string on the clipboard."
' The example will enable auto-conversion of data for this data object.
Dim autoConvert As Boolean = True

' Create a new data object, specifying the data format, data to encapsulate, and enabling
' auto-conversion services.
Dim data As New DataObject(DataFormats.UnicodeText, CType(textData, Object), autoConvert)

' If the data to be copied is supposed to be persisted after the application ends, 
' then set the second parameter of SetDataObject to true.
If persistentData Then
    ' Place the persisted data on the clipboard.
    Clipboard.SetDataObject(data, True)
Else
    ' Place the non-persisted data on the clipboard.
    Clipboard.SetDataObject(data, False)
End If

' If you keep a copy of the source data object, you can use the IsCurrent method to see if
' the data object is still on the clipboard.
Dim isOriginalDataObject As Boolean = Clipboard.IsCurrent(data)

설명

이전에 클립보드에 배치 된 데이터를 여전히 있으며 수정 되지 않은 인지 확인 하려면이 메서드를 사용 합니다.

적용 대상