本文整理匯總了VB.NET中System.Windows.Xps.XpsDocumentWriter.WritingPrintTicketRequired事件的典型用法代碼示例。如果您正苦於以下問題:VB.NET XpsDocumentWriter.WritingPrintTicketRequired事件的具體用法?VB.NET XpsDocumentWriter.WritingPrintTicketRequired怎麽用?VB.NET XpsDocumentWriter.WritingPrintTicketRequired使用的例子?那麽, 這裏精選的事件代碼示例或許可以為您提供幫助。您也可以進一步了解該事件所在類System.Windows.Xps.XpsDocumentWriter
的用法示例。
在下文中一共展示了XpsDocumentWriter.WritingPrintTicketRequired事件的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: PrintMultipleFixedContentDocuments
' ---------------- PrintMultipleFixedContentDocuments ----------------
''' <summary>
''' Prints the content of a multiple fixed document sequence.</summary>
''' <param name="pq">
''' The print queue to print to.</param>
''' <param name="async">
''' true to print asynchronously; false to print synchronously.</param>
Public Sub PrintMultipleFixedContentDocuments(ByVal pq As PrintQueue, ByVal async As Boolean)
' Create a multiple document FixedDocumentSequence.
Dim fds As FixedDocumentSequence = _wpfContent.LoadFixedDocumentSequenceFromDocument()
' Create a document writer to print to.
Dim xdwPrint As XpsDocumentWriter = GetPrintXpsDocumentWriter(pq)
' Set the event handler for creating print tickets for
' each document within the fixed document sequence.
AddHandler xdwPrint.WritingPrintTicketRequired, AddressOf MultipleFixedContentDocuments_WritingPrintTicketRequired
_firstDocumentPrintTicket = 0
' Print either asynchronously or synchronously.
If async Then
PrintMultipleFixedContentDocumentsAsync(xdwPrint, fds)
Else
PrintMultipleFixedContentDocuments(xdwPrint, fds)
End If
End Sub
示例2: level
' ----- MultipleFixedContentDocuments_WritingPrintTicketRequired -----
''' <summary>
''' Creates a PrintTicket event handler for
''' printing a FixedDocumentSequence.</summary>
Private Sub MultipleFixedContentDocuments_WritingPrintTicketRequired(ByVal sender As Object, ByVal e As WritingPrintTicketRequiredEventArgs)
If e.CurrentPrintTicketLevel = PrintTicketLevel.FixedDocumentSequencePrintTicket Then
' Create a PrintTicket for the FixedDocumentSequence. Any
' PrintTicket setting specified at the FixedDocumentSequence
' level will be inherited by lower level (i.e. FixedDocument or
' FixedPage) unless there exists lower level PrintTicket that
' sets the setting differently, in which case the lower level
' PrintTicket setting will override the higher level setting.
Dim ptFDS As New PrintTicket()
ptFDS.PageOrientation = PageOrientation.Portrait
ptFDS.Duplexing = Duplexing.TwoSidedLongEdge
e.CurrentPrintTicket = ptFDS
ElseIf e.CurrentPrintTicketLevel = PrintTicketLevel.FixedDocumentPrintTicket Then
' Use different PrintTickets for different FixedDocuments.
Dim ptFD As New PrintTicket()
If _firstDocumentPrintTicket <= 1 Then
' orientation. Since the PrintTicket at the
' FixedDocumentSequence level already specifies portrait
' orientation, this FixedDocument can just inherit that
' setting without having to set it again.
ptFD.PageOrientation = PageOrientation.Portrait
ptFD.OutputColor = OutputColor.Monochrome
_firstDocumentPrintTicket += 1
Else ' if (_firstDocumentPrintTicket > 1)
' orientation. Since the PrintTicket at the
' FixedDocumentSequence level already specifies portrait
' orientation, this FixedDocument needs to set its
' PrintTicket with landscape orientation in order to
' override the higher level setting.
ptFD.PageOrientation = PageOrientation.Landscape
ptFD.OutputColor = OutputColor.Color
End If
e.CurrentPrintTicket = ptFD
End If ' end:else if (CurrentPrintTicketLevel==FixedDocumentPrintTicket)
' Even though we don't show code for specifying PrintTicket for
' the FixedPage level, the same inheritance-override logic applies
' to FixedPage as well.
End Sub