SilverLight-打印类应用

 

SilverLight打印功能主要应用System.Windows.Printing命名空间

'PrintDocument为SilverLight应用程序提供打印功能
    Dim pd As New System.Windows.Printing.PrintDocument
    Private Sub Init()
        pd = New System.Windows.Printing.PrintDocument
        'PrintPage为当打印每一页时发生的事件
        '另外二个是StartPrint事件和EndPrint事件
        AddHandler pd.PrintPage, New EventHandler(Of System.Windows.Printing.PrintPageEventArgs)(AddressOf PrintPageEvent)
    End Sub

    Private Sub PrintPageEvent(ByVal sender As Object, ByVal e As System.Windows.Printing.PrintPageEventArgs)
        'e.PageVisual为获取或设置要打印的控件元素
        e.PageVisual = Me.reportGrid
    End Sub

    Private Sub btnPrint_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
        'PrintDocument.Print开始打印,参数为文档名称
        pd.Print("打印测试页")
    End Sub

你可能感兴趣的:(object,测试,文档,silverlight)