星期四, 3月 18, 2010

silverlight Clipboard


Imports System.Windows.Browser

Public Class SLClipboard
Private Shared data As String = ""
Public Shared Function GetText() As String
Dim clipboarddata As ScriptObject = HtmlPage.Window.GetProperty("clipboardData")

If IsNothing(clipboarddata) Then
MessageBox.Show("Sorry, this functionality is only avaliable in Internet Explorer.")
Else
data = clipboarddata.Invoke("getData", "text")
End If
Return data
End Function

Public Shared Sub SetText(ByVal txt As String)
data = txt
Dim clipboarddata As ScriptObject = HtmlPage.Window.GetProperty("clipboardData")
If IsNothing(clipboarddata) Then
MessageBox.Show("Sorry, this functionality is only avaliable in Internet Explorer.")
Else
clipboarddata.Invoke("setData", "text", data)
End If
End Sub

End Class

=====
參...
http://weblogs.asp.net/manishdalal/archive/2008/11/12/cross-browser-copy-and-paste-in-datagrid-with-excel-support-part-1.aspx

沒有留言: