The AutoGeneratePreview property is used to determine whether the control should automatically create the print preview pages when they are needed. Normally, the preview pages are automatically generated when the control is rendered. You can set this property to false to prevent that behavior. You would then need to explicitly call the GeneratePreview when you want the preview pages to be synchronously generated.
Public Sub New() InitializeComponent() ' Give the control a reference to a PrintDocument-derived object. Me.ultraPrintPreviewControl1.Document = Me.ultraSchedulePrintDocument1 ' Turn off the AutoGeneratePreview feature. ' If you do this you will be responsible for telling the control ' when to start the preview operation using the GeneratePreview method. ' Alternatively you can set the DisplayPreviewStatus to false and it will ' run the print operation but not show a status dialog. Me.ultraPrintPreviewControl1.AutoGeneratePreview = False Me.ultraPrintPreviewControl1.DisplayPreviewStatus = False ' Only allow for up to three preview pages to be generated. Me.ultraPrintPreviewControl1.MaximumPreviewPages = 3 ' If the resolved mouse action is not already DynamicZoom, make it so. If Me.ultraPrintPreviewControl1.MouseActionResolved <> Infragistics.Win.Printing.PreviewMouseAction.DynamicZoom Then Me.ultraPrintPreviewControl1.MouseAction = Infragistics.Win.Printing.PreviewMouseAction.DynamicZoom End If ' Use anti-aliasing to ensure that the image is smooth and clear. Me.ultraPrintPreviewControl1.UseAntiAlias = True End Sub
public Form1() { InitializeComponent(); // Give the control a reference to a PrintDocument-derived object. this.ultraPrintPreviewControl1.Document = this.ultraSchedulePrintDocument1; // Turn off the AutoGeneratePreview feature. // If you do this you will be responsible for telling the control // when to start the preview operation using the GeneratePreview method. // Alternatively you can set the DisplayPreviewStatus to false and it will // run the print operation but not show a status dialog. this.ultraPrintPreviewControl1.AutoGeneratePreview = false; this.ultraPrintPreviewControl1.DisplayPreviewStatus = false; // Only allow for up to three preview pages to be generated. this.ultraPrintPreviewControl1.MaximumPreviewPages = 3; // If the resolved mouse action is not already DynamicZoom, make it so. if( this.ultraPrintPreviewControl1.MouseActionResolved != Infragistics.Win.Printing.PreviewMouseAction.DynamicZoom ) this.ultraPrintPreviewControl1.MouseAction = Infragistics.Win.Printing.PreviewMouseAction.DynamicZoom; // Use anti-aliasing to ensure that the image is smooth and clear. this.ultraPrintPreviewControl1.UseAntiAlias = 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