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.
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 ); }
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