本文整理匯總了VB.NET中System.Windows.Clipboard.SetDataObject方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Clipboard.SetDataObject方法的具體用法?VB.NET Clipboard.SetDataObject怎麽用?VB.NET Clipboard.SetDataObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Clipboard
的用法示例。
在下文中一共展示了Clipboard.SetDataObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DataObject
' 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)