バージョン

PageNumber プロパティ

現在のページ番号を返します。
シンタックス
'宣言
 
Public ReadOnly Property PageNumber As Integer
public int PageNumber {get;}
使用例
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
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;

		private void ultraSchedulePrintDocument1_PageBodyPrinting(object sender, Infragistics.Win.Printing.PageBodyPrintingEventArgs e)
		{
			// when the first page is printed, prevent the regular
			// page body from being printed
			if (((UltraPrintDocument)sender).PageNumber == 1)
			{
				// 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);

				using (StringFormat sf = new StringFormat(StringFormatFlags.FitBlackBox))
				{
					sf.Alignment = StringAlignment.Center;
					sf.LineAlignment = StringAlignment.Center;
				
					string text = "Infragistics Win\nPrinting Demo";

					using (Font font = new Font("Tahoma", 36f))
						e.Graphics.DrawString(text, font, Brushes.Black, e.RectInsidePadding, sf);
				}
			}
		}

		private void ultraSchedulePrintDocument1_PagePrinted(object sender, Infragistics.Win.Printing.PagePrintedEventArgs e)
		{
			//note: the reprintpage must be honored by the print document and therefore
			//is implementation dependant
			e.ReprintPage = ((UltraPrintDocument)sender).PageNumber == 1;
		}
参照