微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐