本文整理匯總了VB.NET中System.Windows.DataObject.GetDataPresent方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataObject.GetDataPresent方法的具體用法?VB.NET DataObject.GetDataPresent怎麽用?VB.NET DataObject.GetDataPresent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.DataObject
的用法示例。
在下文中一共展示了DataObject.GetDataPresent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: unicodeData
Dim dataObject As New DataObject("Some string data to store...")
' Query for the presence of Text data in the data object, by a data format descriptor string.
' In this overload of GetDataPresent, the method will return true both for native data formats
' and when the data can automatically be converted to the specifed format.
' In this case, string data is present natively, so GetDataPresent returns "true".
Dim textData As String = Nothing
If dataObject.GetDataPresent(DataFormats.StringFormat) Then
textData = TryCast(dataObject.GetData(DataFormats.StringFormat), String)
End If
' In this case, the Text data in the data object can be autoconverted to
' Unicode text, so GetDataPresent returns "true".
Dim unicodeData() As Byte = Nothing
If dataObject.GetDataPresent(DataFormats.UnicodeText) Then
unicodeData = TryCast(dataObject.GetData(DataFormats.UnicodeText), Byte())
End If
示例2: DataObject
Dim dataObject As New DataObject("Some string data to store...")
' Query for the presence of String data in the data object, by type. In this overload
' of GetDataPresent, the method will return true both for native data formats
' and when the data can automatically be converted to the specifed format.
' In this case, the Text data present in the data object can be autoconverted
' to type string (also represented by DataFormats.String), so GetDataPresent returns "true".
Dim stringData As String = Nothing
If dataObject.GetDataPresent(GetType(String)) Then
stringData = TryCast(dataObject.GetData(DataFormats.Text), String)
End If
示例3: unicodeData
Dim dataObject As New DataObject("Some string data to store...")
' Query for the presence of Text data in the data object, by data format descriptor string,
' and specifying whether auto-convertible data formats are acceptable.
' In this case, Text data is present natively, so GetDataPresent returns "true".
Dim textData As String = Nothing
If dataObject.GetDataPresent(DataFormats.Text, False) Then ' Auto-convert?
textData = TryCast(dataObject.GetData(DataFormats.Text), String)
End If
' In this case, the Text data in the data object can be autoconverted to
' Unicode text, but it is not available natively, so GetDataPresent returns "false".
Dim unicodeData() As Byte = Nothing
If dataObject.GetDataPresent(DataFormats.UnicodeText, False) Then ' Auto-convert?
unicodeData = TryCast(dataObject.GetData(DataFormats.UnicodeText), Byte())
End If
' In this case, the Text data in the data object can be autoconverted to
' Unicode text, so GetDataPresent returns "true".
If dataObject.GetDataPresent(DataFormats.UnicodeText, True) Then ' Auto-convert?
unicodeData = TryCast(dataObject.GetData(DataFormats.UnicodeText), Byte())
End If