Version

PageCount Property (UltraPrintPreviewControl)

Returns the number of pages in the preview
Syntax
'Declaration
 
Public Overrides ReadOnly Property PageCount As Integer
public override int PageCount {get;}
Remarks

This is a read-only property that returns an integer value indicating the number of preview pages that will be displayed by the control.

Example
This snippet demonstrates how you can use the PreviewGenerated event and the PageCount property to display the number of pages in the print preview.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub ultraPrintPreviewControl1_PreviewGenerated(sender As Object, e As System.EventArgs) Handles Me.ultraPrintPreviewControl1.PreviewGenerated

	' Get the number of pages in the preview as a string.
   Dim pageCount As String = Me.ultraPrintPreviewControl1.PageCount.ToString()

	' Change the form's Text to display that number in a formatted string.
   Me.Text = [String].Format("Print Preview [{0} pages]", pageCount)

End Sub
private void ultraPrintPreviewControl1_PreviewGenerated(object sender, System.EventArgs e)
{
	// Get the number of pages in the preview as a string.
	string pageCount = this.ultraPrintPreviewControl1.PageCount.ToString();

	// Change the form's Text to display that number in a formatted string.
	this.Text = String.Format( "Print Preview [{0} pages]", pageCount );
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also