Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing
    Private Sub UltraSchedulePrintDocument1_PageBodyPrinting(ByVal sender As Object, ByVal e As Infragistics.Win.Printing.PageBodyPrintingEventArgs) Handles UltraSchedulePrintDocument1.PageBodyPrinting
        ' when the first page is printed, prevent the regular
        ' page body from being printed
        If CType(sender, UltraPrintDocument).PageNumber = 1 Then
            'mark the event as handled so page body of the print document will
            'not be rendered
            e.Handled = True
            ' the title page will have a gray background
            e.Graphics.FillRectangle(Brushes.LightGray, e.RectInsidePadding)
            Dim sf As StringFormat = Nothing
            Dim font As Font = Nothing
            Try
                sf = New StringFormat(StringFormatFlags.FitBlackBox)
                sf.Alignment = StringAlignment.Center
                sf.LineAlignment = StringAlignment.Center
                Dim text As String = "Infragistics Win\nPrinting Demo"
                font = New Font("Tahoma", 36.0F)
                e.Graphics.DrawString(text, font, Brushes.Black, RectangleF.op_Implicit(e.RectInsidePadding), sf)
            Finally
                'clean up
                If Not font Is Nothing Then font.Dispose()
                If Not sf Is Nothing Then sf.Dispose()
            End Try
        End If
    End Sub
    Private Sub UltraSchedulePrintDocument1_PagePrinted(ByVal sender As Object, ByVal e As Infragistics.Win.Printing.PagePrintedEventArgs) Handles UltraSchedulePrintDocument1.PagePrinted
        'note: the reprintpage must be honored by the print document and therefore
        'is implementation dependant
        e.ReprintPage = CType(sender, UltraPrintDocument).PageNumber = 1
    End Sub