Clipboard.IsCurrent(IDataObject) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 데이터 개체를 클립보드의 내용과 비교합니다.
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
시스템 클립보드의 내용과 비교할 데이터 개체입니다.
반품
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)
설명
이 메서드를 사용하여 이전에 클립보드에 배치된 데이터 개체가 여전히 존재하고 수정되지 않은지 확인합니다.