Version

GeneratePreview Method

Used to verify/force the creation of the preview pages.
Syntax
'Declaration
 
Public Sub GeneratePreview( _
   ByVal recreate As Boolean _
) 
public void GeneratePreview( 
   bool recreate
)

Parameters

recreate
If true, any existing preview information will be discarded and the preview will be regenerated. If false, the preview will only be generated if it has not already been generated.
Remarks

The GeneratePreview method is used to synchronously cause the generation of the preview pages. By default, the pages will be generated when pages are requested although the automatic generation of pages can be prevented by setting the AutoGeneratePreview to false.

Example
This snippet shows how you can delay the generation of the print preview. It also shows how to print the generated preview.

Public Sub New()

   InitializeComponent()
   
   ' Prevent the control from automatically generating the print preview
   ' when the Form loads.
   '
   Me.ultraPrintPreviewControl1.AutoGeneratePreview = False

End Sub


Private Sub btnGeneratePreview_Click(sender As Object, e As System.EventArgs) Handles Me.btnGeneratePreview.Click

   ' Tell the control to generate the print preview.
   '
   Me.ultraPrintPreviewControl1.GeneratePreview(False)

End Sub


Private Sub btnPrint_Click(sender As Object, e As System.EventArgs) Handles Me.btnPrint.Click

   ' Tell the control to print.  Passing true means that
   ' it will display a status dialog.
   '
   Me.ultraPrintPreviewControl1.Print(True)

End Sub
public PrintPreviewForm()
{
	InitializeComponent();

	// Prevent the control from automatically generating the print preview
	// when the Form loads.
	//
	this.ultraPrintPreviewControl1.AutoGeneratePreview = false;
}

private void btnGeneratePreview_Click(object sender, System.EventArgs e)
{
	// Tell the control to generate the print preview.
	//
	this.ultraPrintPreviewControl1.GeneratePreview( false );
}

private void btnPrint_Click(object sender, System.EventArgs e)
{
	// Tell the control to print.  Passing true means that
	// it will display a status dialog.
	//
	this.ultraPrintPreviewControl1.Print( true );
}
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