本文整理匯總了VB.NET中System.Windows.Forms.DataFormats類的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataFormats類的具體用法?VB.NET DataFormats怎麽用?VB.NET DataFormats使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DataFormats類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyClass1
Option Explicit
Option Strict
Imports System.Windows.Forms
Public Class MyClass1
Inherits Form
Private textBox1 As TextBox
Public Sub MyClipboardMethod()
' Creates a new data format.
Dim myFormat As DataFormats.Format = _
DataFormats.GetFormat("myFormat")
' Creates a new object and store it in a DataObject using myFormat
' as the type of format.
Dim myObject As New MyNewObject()
Dim myDataObject As New DataObject(myFormat.Name, myObject)
' Copies myObject into the clipboard.
Clipboard.SetDataObject(myDataObject)
' Performs some processing steps.
' Retrieves the data from the clipboard.
Dim myRetrievedObject As IDataObject = Clipboard.GetDataObject()
' Converts the IDataObject type to MyNewObject type.
Dim myDereferencedObject As MyNewObject = _
CType(myRetrievedObject.GetData(myFormat.Name), MyNewObject)
' Print the value of the Object in a textBox.
textBox1.Text = myDereferencedObject.MyObjectValue
End Sub
End Class
' Creates a new type.
<Serializable()> Public Class MyNewObject
Inherits Object
Private myValue As String
' Creates a default constructor for the class.
Public Sub New()
myValue = "This is the value of the class"
End Sub
' Creates a property to retrieve or set the value.
Public Property MyObjectValue() As String
Get
Return myValue
End Get
Set
myValue = value
End Set
End Property
End Class