2010年1月26日 星期二

Silverlight clipboard and printing testing

Silverlight 4 supports clipboard and printing functions directly, instead of using Windows API.

Regarding to clipboard, Silverlight only provides TEXT copy/paste functions, without IMAGE functions. The usage is as follows:

Clipboard.SetText(TextBox1.Text)


And we could provide the printing function with the following code:

Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf PrintPage
pd.Print()


Sub PrintPage(ByVal s As Object, ByVal e As PrintPageEventArgs)
e.PageVisual = Chart1 ' LayoutRoot
End Sub


PrintPage function is the event handler of printing.

沒有留言:

張貼留言